time limit per test: 0.25 sec. memory limit per test: 4096 KB
input: standard output: standard
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.
Test #1 3 100 011 010
Test #2 3 100 101 010
Test #1 YES 100 010 000
Test #2 NO
Andrew V. Lazarev
Codeforces (c) Copyright 2010-2020 Mike Mirzayanov