#abc291e. E - Find Permutation
E - Find Permutation
Score : points
问题描述
存在一个长度为 的序列 ,它是 的一个排列。
虽然你并不知道序列 ,但你知道对于 对整数 ,有 成立。
能否唯一确定序列 ?如果可以,请找出序列 。
以上为通义千问 qwen-max 翻译,仅供参考。
Problem Statement
There is a length- sequence that is a permutation of .
While you do not know , you know that for pairs of integers .
Can be uniquely determined? If it is possible, find .
Constraints
- All values in the input are integers.
- There is an consistent with the input.
Input
The input is given from Standard Input in the following format:
Output
If can be uniquely determined, print Yes
in the first line. Then, print in the second line, separated by spaces.
If cannot be uniquely determined, just print No
.
Sample Input 1
3 2
3 1
2 3
Sample Output 1
Yes
3 1 2
We can uniquely determine that .
Sample Input 2
3 2
3 1
3 2
Sample Output 2
No
Two sequences and can be .
Sample Input 3
4 6
1 2
1 2
2 3
2 3
3 4
3 4
Sample Output 3
Yes
1 2 3 4
update @ 2024/3/10 12:09:00