#P9923. [POI 2023/2024 R1] Przyciski
[POI 2023/2024 R1] Przyciski
Background
Translated from XXXI Olimpiada Informatyczna - Stage I Przyciski。
Problem Description
There is an square grid with buttons inside.
You need to press some (at least one) buttons so that, for every row and every column, the parity of the number of pressed buttons is the same.
Input Format
The first line contains two positive integers .
The next lines each contain two positive integers, representing the coordinates of a button.
Output Format
If there is no solution, output one line NIE.
If there is a solution, output TAK on the first line. On the second line output a positive integer , the number of buttons you press. On the third line output several positive integers, the indices of the buttons you press.
3 6
1 1
1 2
2 2
3 1
3 2
3 3
TAK
4
1 2 4 5
9 1
1 1
NIE
见附件
TAK
4
1 2 10 11
见附件
TAK
4
1 2 100001 100002
Hint
Explanation for Sample 1: .
Constraints: For all testdata, , .
| Subtask ID | Additional Constraints | Score |
|---|---|---|
| 1 | 24 | |
| 2 | If there is a solution, it is guaranteed that an even-size solution exists. | |
| 3 | If there is a solution, it is guaranteed that an odd-size solution exists. | |
| 4 | 28 |
If a solution exists and you correctly state that a solution exists but your construction is wrong, you can get of the score.
Translated by ChatGPT 5