sort
You cannot submit for this problem because the contest is ended. You can click "Open in Problem Set" to view this problem in normal mode.
排序
给你 m 对(,),其中 1≤<≤n,我们定义如下程序来对一个排列进行排序:

该程序也可以如下表示

判断这个程序是否能对所有长度为 n 的排列 p 进行排序。
输入
第一行包含两个整数 n 和 m(2≤n≤2×,1≤m≤2×)。
接下来 m 行,每行包含两个整数(,)(1≤<≤n)。
输出
如果能对所有排列进行排序,输出 “Yes”,否则输出 “No”。
示例
标准输入
5 7
1 3
1 3
2 4
3 5
1 4
2 5
1 5
标准输出
No
标准输入
3 3
1 2
1 3
2 3
标准输出
Yes
第九届西南石油大学程序设计新生赛(验题)
- Status
- Done
- Rule
- ACM/ICPC
- Problem
- 12
- Start at
- 2025-10-18 18:15
- End at
- 2025-10-26 16:15
- Duration
- 190 hour(s)
- Host
- Partic.
- 9