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.
We are given a board of squares, where is an odd integer meeting the inequality , and a set of stones. Each stone has the shape of a rectangle covering exactly 2 squares of the board. The board squares are numbered consecutively by rows - the squares in the first row (from left to right) are numbered from to , the squares in the second row from to , and so on until we reach the bottom right corner square whose number is .
We cut any three squares out of the board, and next we want to cover it with the stones. We require that every square not removed should be covered with exactly one stone (covering also one adjacent square) and that cut out squares remain uncovered.
Is it always possible?
Write a program that:
If there are many ways to cover the board with stones, your program should write only one (arbitrary) of them.
In the only line of the standard input there are written four numbers separated by single spaces. The first number is the dimension of the board , and the three other are the numbers of the cut out squares. The last number is followed by the end of the line.
The data in the standard input are written correctly, and your program need not verify that.
The standard output should contain:
For the input data:
7 17 25 40
the correct result is:
18 19 20 21 8 9 10 11 12 13 14 7 6 5 4 3 1 2 15 22 16 23 29 36 30 37 24 31 32 39 43 44 38 45 46 47 48 49 41 42 33 34 35 28 26 27
For the input data:
7 25 32 40
the correct result is:
NIE
Task author: Wojciech Rytter.