229. Divide and conquer
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.
Input
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).
Output
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.
Sample test(s)
Input
Test #1
3
100
011
010
Test #2
3
100
101
010
Output
Test #1
YES
100
010
000
Test #2
NO
Author:  Andrew V. Lazarev

Resource: 

Date: 

Server time: 20180219 01:06:01  Online Contester Team © 2002  2016. All rights reserved. 

