Problem F
Letter Optimization
Languages
en
ja
sv
The programming olympiad committee, composed of
Each person
Which people have the property that
Input
The first line contains an integer
Let
The production chain is designed in such a way that no person can get back a letter they have already worked on.
Output
Print a line with all
It’s guaranteed that if
If, on the other hand,
Points
Your solution will be tested on several test case groups. To get the points for a group, it must pass all the test cases in the group.
Group |
Point value |
Bounds |
|
|
Each person sends letters to at most one person (i.e.
|
|
|
Each person receives letters from exactly one other
person, except person |
|
|
If person |
|
|
|
|
|
No additional constraints. |
Explanation of test case
Here are three graphs that represent the three example cases. Each person is represented by a node. On each edge, the number of envelopes sent is written in the unit "ps", envelopes per second.
Note that in test case group
In test case groups
![\includegraphics[width=0.8\textwidth ]{sample1}](/problems/brevoptimering/file/statement/en/img-0001.png)
![\includegraphics[width=0.8\textwidth ]{sample2}](/problems/brevoptimering/file/statement/en/img-0002.png)
![\includegraphics[width=0.8\textwidth ]{sample3}](/problems/brevoptimering/file/statement/en/img-0003.png)
Sample Input 1 | Sample Output 1 |
---|---|
8 7 0 10 1 6 100 8 1 4 100 9 1 1 100 11 0 12 1 5 100 10 1 3 100 5 0 |
1 2 3 7 8 |
Sample Input 2 | Sample Output 2 |
---|---|
10 16 3 2 50 4 25 6 25 9 2 9 75 5 25 2 1 8 100 5 0 1 0 2 2 3 90 7 10 1 0 1 0 5 1 10 100 6 0 |
1 5 6 8 9 |
Sample Input 3 | Sample Output 3 |
---|---|
6 10 3 2 25 3 25 4 50 1000 1 5 100 1000 1 5 100 1000 1 6 100 1 1 6 100 1000 0 |
1 5 |