W razie problemów technicznych ze Szkopułem, prosimy o kontakt mailowy pod adresem [email protected].
Jeśli chciałbyś porozmawiać o zadaniach, rozwiązaniach lub problemach technicznych, zapraszamy na serwery Discord. Są one moderowane przez społeczność, ale członkowie zespołu technicznego też są tam aktywni.
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.