QOJ.ac

QOJ

Límite de tiempo: 5 s Límite de memoria: 1024 MB Puntuación total: 100
Estadísticas

每当 KAIST 的学生走出校园时,他们通常会沿着一条名为“无尽之路”(Endless Road)的笔直道路行走。这个名字来源于大多数学生觉得这条路仿佛没有尽头。造成这种感觉的一个因素是沿途单调的风景。在这里,我们将“无尽之路”建模为一条长度为 $10^9$ 的直线。直线上的位置可以用一个实数 $x \in [0, 10^9)$ 来表示。

为了应对这种情况,RUN@KAIST 的成员决定在这条路上种植各种色彩鲜艳的花朵。RUN@KAIST 的 $N$ 名成员编号为 $1$ 到 $N$。在上次例会上,每位成员都被分配了直线上一个非空区间 $[L_i, R_i)$,包含所有满足 $L_i \le x < R_i$ 的位置 $x$。

索引较高的成员在社团中承担更多的责任。因此,随着成员索引的增加,区间长度是非递减的。换句话说,对于 $1 \le i < j \le N$,满足 $R_i - L_i \le R_j - L_j$。

种植工作分 $N$ 轮进行。在每一轮中,我们选择一名之前未被选中的成员来种植花朵。被选中的成员会在其分配的区间 $[L_i, R_i)$ 内种植花朵,但其他成员之前已经种植过花朵的地方除外。

为了使工作分配更加公平,选择方式如下:

  • 选择将种植最少数量花朵的成员。这里,花朵的数量由该成员将种植新花朵的区间总长度决定,该长度可能为零。
  • 如果有多个这样的成员,则选择索引最小的成员。

Jaeung 现在需要宣布种植计划。为此,他必须根据上述选择规则,找到 $N$ 名成员种植花朵的顺序。请帮他完成这项工作。

输入格式

第一行包含一个整数 $N$ ($1 \le N \le 250\,000$)。

接下来的 $N$ 行,每行包含两个整数 $L_i$ 和 $R_i$ ($0 \le L_i < R_i \le 10^9$,$R_i - L_i \le R_j - L_j$,对于所有 $1 \le i < j \le N$)。

所有区间各不相同。换句话说,对于所有 $1 \le i < j \le N$,$(L_i, R_i) \neq (L_j, R_j)$。

输出格式

输出 $N$ 个整数,表示种植顺序。第 $i$ 个整数表示在第 $i$ 轮种植花朵的成员编号。

样例

样例输入 1

6
1 2
2 3
3 4
4 5
1 3
3 5

样例输出 1

1 2 5 3 4 6

样例输入 2

4
3 7
10 14
1 6
6 11

样例输出 2

1 3 2 4

Editorials

IDTypeStatusTitlePosted ByLast UpdatedActions
#870EditorialOpen题解alpha10222026-01-28 02:35:25View

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.