QOJ.ac

QOJ

حد الوقت: 0.7 s حد الذاكرة: 1024 MB مجموع النقاط: 100 قابلة للهجوم ✓

#6550. 淘汰赛

الإحصائيات

你正在参加一场淘汰赛锦标赛。锦标赛共有 $n$ 名参赛者,编号从 $1$ 到 $n$,比赛包含在不同赛道上进行的 $n - 1$ 场比赛。每场比赛结束后,最后一名参赛者将被淘汰。所有比赛结束后,唯一剩下的参赛者将加冕为冠军。

作为一名经验丰富的参赛者,你知道每辆车在每条赛道上的速度,因此你可以预测每场比赛的结果。然而,赛道的顺序尚未确定。你的任务是对于每一位参赛者,判断是否存在一种赛道排列顺序,能使他获得最终的胜利。

输入格式

第一行包含一个整数 $n$ ($2 \le n \le 500$):参赛者人数。

接下来的 $n - 1$ 行,每行描述一条赛道,包含一个 $1$ 到 $n$ 的排列:表示该赛道上参赛者到达终点的顺序,从最快到最慢。

输出格式

你需要输出 $n$ 个答案。第 $i$ 个答案应遵循以下格式:

如果第 $i$ 位参赛者有可能赢得锦标赛,请在第一行输出 “Yes”(不含引号,不区分大小写)。在第二行,输出一个 $1$ 到 $n-1$ 的排列:即能使第 $i$ 位参赛者获胜的赛道顺序。赛道按输入中给出的顺序编号。

否则,请在单行内输出 “No”。

如果存在多种答案,输出其中任意一种即可。

样例

样例输入 1

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

样例输出 1

Yes
3 2 1
No
No
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.