229. Divide and conquer
time limit per test: 0.25
memory limit per test: 4096
You are to write a program which will divide set Q of squares into two parts, in such a way that one of them can be presented as other after rotations on 90 degrees and shifts along some vector. Set Q is the subset of NxN square.
The first line of the input contains the integer N (1 <= N <= 20). The following N lines contain description of the set Q (symbol '1' means that square belongs to Q and '0' otherwise).
Write 'YES' in the first line of the output, if such division exists, and 'NO' otherwise. In the first case output one of the subsets of Q.
|Author:||Andrew V. Lazarev
|Server time: 2017-09-20 16:48:01||Online Contester Team © 2002 - 2016. All rights reserved.|