QOJ.ac

QOJ

Limite de temps : 3 s Limite de mémoire : 262144 MB Points totaux : 100 Hackable ✓

#13215. 纳米俄罗斯套娃

Statistiques

套娃是传统的俄罗斯递归玩偶。但万物皆在变化,即使是套娃也需要一点创新。由于新材料的使用,制造出既薄又不失耐用性的套娃成为可能。很快,这些新型纳米套娃充斥了市场。现在,推销员 Alexander 遇到了一个问题:他需要将所有的纳米套娃摆放在商店的货架上。

每个纳米套娃都有一个内部体积和一个外部体积。如果第一个纳米套娃的外部体积不超过第二个纳米套娃的内部体积,那么第一个纳米套娃就可以放入第二个中。Alexander 确信,纳米套娃应该排成一排摆放,使得没有任何一个纳米套娃(最后一个除外)能放入货架上的下一个套娃中。请帮助 Alexander,他可能会给你一些纳米套娃的折扣!

输入格式

第一行包含一个整数 $n$ ($2 \le n \le 10^5$),表示纳米套娃的数量。接下来的 $n$ 行,每行包含两个整数:对应纳米套娃的内部体积和外部体积。保证每个纳米套娃的内部体积不超过其外部体积,但两者可以相等。所有数值均在 $1$ 到 $10^6$ 的范围内。

输出格式

如果无法按所述顺序摆放纳米套娃,请输出 “No”。否则,在第一行输出 “Yes”,并在第二行输出 $n$ 个整数:货架上纳米套娃的摆放顺序编号。纳米套娃的编号从 $1$ 开始,按其在输入文件中出现的顺序排列。如果存在多种方案,输出其中任意一种即可。

样例

输入 1

3
1 5
2 2
6 7

输出 1

Yes
3 1 2

输入 2

3
2 2
2 2
3 4

输出 2

No

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.