EVANESCENT
시간 제한3초메모리 제한1024 MB
체비쇼프 거리 합으로 만들어진 격자 피해 값이 주어질 때, 이를 만드는 폭발 위치 집합을 하나 복원한다.
문제
Reiuji Utsuho and Hakurei Reimu decided to compete to see whose abilities were superior.
Their duel takes place on a grid of size . Columns are numbered from to from left to right, and rows are numbered from to from top to bottom. The cell in row and column is denoted as .
Utsuho can use her ability to cause explosions in certain cells of the grid. There is no limit on the number of cells she can choose, but explosions are only allowed in the inner cells. More precisely, if an explosion occurs at cell , then its row and column indices must satisfy .
Uniquely, the explosions Utsuho uses in this battle are special --- Their destructive power grows stronger the farther away a cell is from the explosion's origin. Formally, the damage a cell receives from a single explosion at is defined as If there are multiple explosions, the total damage to is the sum of contributions from all explosions.
Before Utsuho even unleashed her power, Reimu used her foresight. She managed to foresee the total damage that each cell on the grid would receive after all explosions. With this knowledge, she hoped to pinpoint the exact locations of Utsuho's explosions and stop them in advance. However, her vision revealed only the damage values and not the precise origin of the blasts.
Given the total damage values of all cells, find any valid set of explosion locations that could explain Reimu's foresight.
입력
The first line contains a single integer .
The next lines each contain non-negative integers separated by spaces. The -th integer on the next -th line represents the total damage value of cell , where rows and columns are numbered from to as described above.
출력
Over a total of lines, output integers per line, separated by spaces. Each integer must be either or . If the integer in row and column is , an explosion is scheduled to occur at cell . If it is , no explosion is scheduled at cell .
If multiple possible explosion scenarios exist, outputing just one is sufficient. At least one possible explosion scenario is guaranteed to exist.