#P7403. [BalticOI 2002] Tennis Club (Day1)
[BalticOI 2002] Tennis Club (Day1)
Description
There are people who want to make friends with each other. Person wants to make friends with people.
Find one feasible assignment of friendships.
Input Format
The first line contains an integer , representing the number of people.
The next lines each contain an integer , meaning that person wants to make friends with people.
Output Format
If there is no solution, output NO SOLUTION in one line.
If there is a solution, first output SOLUTION in one line.
Then output lines, where line contains integers, indicating with which people person makes friends.
Note that in any solution, the integers in line must be output in increasing order.
If there are multiple solutions, output any one of them.
3
1
2
1
SOLUTION
2
1 3
2
3
2
2
1
NO SOLUTION
Hint
Constraints
For of the testdata, , .
This problem uses Special Judge.
Notes
Translated from BalticOI 2002 Day1 B Tennis Club。
Translated by ChatGPT 5
京公网安备 11011102002149号