III Olympiad in Informatics 1995/1996
|
Task: NIE
|
Author: Wojciech Rytter
|
III stage contest |
A
knight attacks squares on the chess-board as is show in figure 1.
There is a chess-board of dimensions 3 * n, with 3 rows and n columns, where 1 <= n <= 100, and there is a set Z of fields on the chess-board. The rows are numbered from the top to the bottom with numbers from 1 to 3, the columns from the left to the right with numbers from 1 to n.
Knights can be put only on the squares from the set Z and no two of them can attack each other.
We assume that in each column at most one field belongs to the set Z. Thus the set Z may be described with a series: k1, k2, ... , kn, where ki belongs to {0, 1, 2, 3}. If ki = 0 then no field in the i-th column belongs to the set Z, else ki is a number of a row of the only field in this column, which belongs to Z.
Your program should look for the file NIE.IN in the current directory and produce the output file NIE.OUT in the current directory too. The file containing the source code of your program should have a name NIE.???, whereas you should put three-letter abbreviation of the used programming language name instead of ???. The same program in executable form should be written in file NIE.EXE