QOJ.ac

QOJ

時間限制: 1.0 s 記憶體限制: 512 MB 總分: 100 可 Hack ✓

#7137. 序列排序

统计

给定 $n$ 个序列 $s_1, s_2, \dots, s_n$,请将它们按字典序排序。

输入格式

第一行包含一个整数 $n$ ($1 \le n \le 1000000$)。

接下来 $n$ 行,每行包含一个整数 $k_i$,表示序列 $s_i$ 的长度,随后是 $k_i$ 个整数 $s_{i,1}, s_{i,2}, \dots, s_{i,k_i}$,表示序列 $s_i$ ($1 \le s_{i,1} \le s_{i,2} \le \dots \le s_{i,k_i} \le 5000000$)。

($k_i \ge 1, k_1 + k_2 + \dots + k_n \le 5000000$)

由于输入数据量极大,建议使用以下代码片段来读取 32 位整数。

#include <cctype>
int get_int() {
    char ch = getchar();
    while (!isdigit(ch)) ch = getchar();
    int ret = 0;
    while (isdigit(ch)) {
        ret = ret * 10 + ch - '0';
        ch = getchar();
    }
    return ret;
}

输出格式

输出 $n$ 个整数 $p_1, p_2, \dots, p_n$,其中 $p_i$ 表示第 $i$ 小的序列的原始下标。

如果有两个或多个序列相同,则按它们的下标从小到大排序。

样例

输入 1

4
2 1 3
1 12
3 1 3 4
2 1 3

输出 1

1
4
3
2

Discussions

About Discussions

The discussion section is only for posting: General Discussions (problem-solving strategies, alternative approaches), and Off-topic conversations.

This is NOT for reporting issues! If you want to report bugs or errors, please use the Issues section below.

Open Discussions 0
No discussions in this category.

Issues

About Issues

If you find any issues with the problem (statement, scoring, time/memory limits, test cases, etc.), you may submit an issue here. A problem moderator will review your issue.

Guidelines:

  1. This is not a place to publish discussions, editorials, or requests to debug your code. Issues are only visible to you and problem moderators.
  2. Do not submit duplicated issues.
  3. Issues must be filed in English or Chinese only.
Active Issues 0
No issues in this category.
Closed/Resolved Issues 0
No issues in this category.