| 시간 제한 | 메모리 제한 | 제출 | 정답 | 맞힌 사람 | 정답 비율 |
|---|---|---|---|---|---|
| 1 초 | 1024 MB | 0 | 0 | 0 | 0.000% |
A boxing club has $N$ members, numbered $1, \ldots, N$. Each member has a fixed strength. The strengths are unique integers with unknown values.
In a boxing match, a stronger boxer always beats a weaker one... or rather, would beat in an honest match. The thing is, there are two cheaters in the club. They use illegal tricks and could beat any honest boxer. To avoid suspicion, each of them picks (independently from the other) a number of honest boxers; in subsequent matches, they will always win against the chosen boxers and deliberately lose against all others. The cheaters also agree on who will win when they meet each other in a match.
Now the coach has caught wind of the scheme and wants to expel the cheaters. For that, he arranged a tournament where each member met each other in a match. However, the club has many members, and the coach can't program, so he has asked you to help.
You are given the results of the tournament and need to find two members such that when these two are removed, the results of the remaining boxers are consistent with the "a stronger boxer always beats a weaker one" rule. If there are several possible solutions, output any one of them. The coach is not much of a justice warrior, he mainly just wants to blame someone...
The first line contains $N$ ($3 \le N \le 3 \cdot 10^3$), the number of boxers. The following $N$ lines present a table consisting of 0, 1, and x. If the $i$-th boxer won against the $j$-th, then the table has 1 in the $i$-th row of the $j$-th column and 0 in the $j$-th row of the $i$-th column.
Output two space-separated integers, the numbers of the cheaters, in any order. All the inputs are such that a solution exists.
6 x00011 1x1011 10x111 110x10 0000x1 00010x
1 4
If we remove the first and the fourth boxer, the remaining table is as follows:
x111 0x11 00x1 000x
It's now clear that the second boxer is the strongest, followed by the third, the fifth, and the sixth.
11 x1111010010 0x000001001 01x11011011 010x0001001 0101x010011 11111x10111 010100x0001 1000111x011 11111011x11 010100100x0 1000000001x
8 11
Olympiad > Estonian Informatics Olympiad > 2020-21 > Final Round 5번