시간 제한 | 메모리 제한 | 제출 | 정답 | 맞힌 사람 | 정답 비율 |
---|---|---|---|---|---|
1 초 | 128 MB | 17 | 10 | 10 | 90.909% |
We are given a board of n × n squares, where n is an odd integer meeting the inequality 3 ≤ n < 50, and a set of k = (n2 - 3)/2 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 1 to n, the squares in the second row from n+1 to 2n, and so on until we reach the bottom right corner square whose number is n2.
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:
NIE
("no") in the standard output.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 n, 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:
NIE
7 17 25 40
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
7 25 32 40
NIE
Olympiad > Polish Olympiad in Informatics > POI 1994/1995 > Stage 2 4번