#P6663. [POI 2019/2020 R1] Układ scalony / 集成电路
[POI 2019/2020 R1] Układ scalony / 集成电路
Background
Bajtel Company specializes in producing integrated circuit boards.
Problem Description
The integrated circuit board produced by Bajtel Company has size , and the cell that is powered at the beginning is .
We can connect a wire between two adjacent cells so that electricity can flow from one cell to the other. Several wires form an integrated circuit.
Now we need to connect wires, and require that the longest integrated circuit has length exactly , and also require that all cells are powered.
Find one way to connect the wires.
Input Format
One line with three integers , representing the board size and the required length of the longest integrated circuit.
Output Format
If there is no wiring method that satisfies the statement, output a string NIE and terminate.
If there exists a wiring method that satisfies the statement:
Output one string TAK on the first line.
Then output lines, each with four integers , meaning there is a wire connecting and .
If there are multiple valid solutions, output any one.
2 3 4
TAK
1 1 1 2
1 1 2 1
1 2 2 2
2 3 2 2
1 2 1 3
2 3 1
NIE
2 3 3
TAK
1 2 2 2
1 1 1 2
2 2 2 3
1 2 1 3
2 2 2 1
1 10 10
NIE
Hint
Sample Explanation
For sample , as shown in the figure below.

Another additional sample set can be found in the attached file sample.zip.
Constraints
This problem uses bundled testdata.
- Subtask 1 (20 pts): .
- Subtask 2 (20 pts): .
- Subtask 3 (30 pts): is odd.
- Subtask 4 (30 pts): is even.
For of the data, , .
If you output TAK (and this test case indeed has a solution), but you make mistakes in the wiring description afterward (while still keeping the output format valid), you can get of the score.
Note
Translated from POI 2019 E Układ scalony.
Translated by ChatGPT 5