PivotOJ

Cursed Game

시간 제한: 2000ms메모리 제한: 1024MB출처: ICPC Asia Jakarta Regional 2023BOJ 32078

문제

You found an antique box in your warehouse and decided to open it. The moment you open the box, it traps you into a cursed game where you are playing against a demon. The game consists of 333333 rounds and you have to win all rounds in order to escape. The demon also gives you 999999 coins that you can use throughout all rounds.

Note that in this problem, denote cell (r,c)(r, c) of a grid as the cell in row rr and column cc of the grid.

Before the start of each round, the demon will prepare a secret paper, which can be represented as a grid with 33 rows and 33 columns, both numbered from 11 to 33. The demon will secretly put a hole in one or more cells, and you are not aware which cells have a hole in it. Then, the round starts with the demon giving you an odd integer NN (3 ≤ N ≤ 33).

Within each round, you can ask the demon several queries, each costing you one coin. For each query, you are allowed to give the demon your paper, which can be represented as a grid with NN rows and NN columns, both numbered from 11 to NN. Each cell is coloured either black or white by you.

For each of your query, the demon will calculate a binary result grid with N2N - 2 rows and N2N - 2 columns, both numbered from 11 to N2N - 2. The value on cell (r,c)(r, c) of the result grid is filled as follows.

  • The demon will put the secret paper on top of your paper such that the cell (r+i1,c+j1)(r + i - 1, c + j - 1) of your paper aligns with the cell (i,j)(i, j) of the secret paper, for 1 ≤ i, j ≤ 3.
  • The demon can only see the colour of the cell in your paper if the corresponding cell in the secret paper has a hole in it.
  • The value on cell (r,c)(r, c) of the result grid is 11 if there is an odd number of black cells that it can see through the holes, or 00 otherwise.

You win the round if the result grid consists of only the values 11. Otherwise, the demon will give you the result grid as a feedback, and the round continues.

If you have spent all the coins and still did not win all the rounds, then you will be trapped forever. Escape the cursed game!

예제

예제 1

입력
3



INCORRECT
0



CORRECT
5





INCORRECT
111
001
111





CORRECT
(start of round 3, continue until 333 rounds)
출력
111
000
111


111
111
111


10011
10011
00000
11010
11011




11011
11011
00100
11011
11011
이 문제는 채점 준비 중입니다. 테스트 데이터가 확보되면 제출이 가능합니다.