#P6867. [COCI 2019/2020 #5] Politicari
[COCI 2019/2020 #5] Politicari
Description
There are people who criticize each other.
You are also given a matrix .
The rules are as follows:
-
For the first time, person criticizes person .
-
If at the -th time, person criticizes person ,
then at the -th time, person criticizes person .
Find who is doing the criticizing at the -th time (note: not the person being criticized).
Input Format
The first line contains two positive integers, and .
The next lines contain the matrix . The main diagonal of the matrix (the diagonal from top-left to bottom-right) is all , and all other entries are positive integers from to .
Output Format
Output one line containing your answer.
2 4
0 2
1 0
2
3 7
0 3 2
3 0 3
2 1 0
1
4 7
0 4 3 2
4 0 4 1
2 1 0 1
3 2 3 0
3
Hint
Constraints
- For pts of the testdata, it is guaranteed that .
- For all testdata, and .
Notes
This problem is translated from COCI2019-2020 CONTEST #5 T2 Političari, translated by 90693。
Translated by ChatGPT 5
京公网安备 11011102002149号