In the event of technical difficulties with Szkopuł, please contact us via email at [email protected].
If you would like to talk about tasks, solutions or technical problems, please visit our Discord servers. They are moderated by the community, but members of the support team are also active there.
A knight attacks squares on the chess-board as is show in the following figure (the knight on the square attacks squares marked by a cross).
There is a chess-board of dimensions , with rows and columns, where , and there is a set of fields on the chess-board. The rows are numbered from the top to the bottom with numbers from to , the columns from the left to the right with numbers from to .
Knights can be put only on the squares from the set and no two of them can attack each other. We assume that in each column at most one field belongs to the set . Thus the set may be described with a series: , where . If then no field in the -th column belongs to the set , else is a number of a row of the only field in this column, which belongs to .
Write a program that:
In the first line of the standard input there is written one positive integer , . This is the number of columns in the chess-board. In each of the following lines there is written one number form the set . These are the consecutive terms of the series describing the set .
In the standard output two integers and separated by a single space should be written.
For the input data:
2 1 0
the correct result is:
4 2
Task author: Wojciech Rytter.