1+ N = int (input ())
2+ paper = list ()
3+ minus , zero , plus = 0 , 0 , 0
4+ for _ in range (N ):
5+ paper .append (list (map (int , input ().split ())))
6+
7+ def check (row , col , n ):
8+ global minus , zero , plus
9+ curr = paper [row ][col ]
10+
11+ for i in range (row , row + n ):
12+ for j in range (col , col + n ):
13+ if paper [i ][j ] != curr :
14+ next_n = n // 3
15+ check (row , col , next_n ) # 1
16+ check (row , col + next_n , next_n ) # 2
17+ check (row , col + (2 * next_n ), next_n ) # 3
18+ check (row + next_n , col , next_n ) # 4
19+ check (row + next_n , col + next_n , next_n ) # 5
20+ check (row + next_n , col + (2 * next_n ), next_n ) # 6
21+ check (row + (2 * next_n ), col , next_n ) # 7
22+ check (row + (2 * next_n ), col + next_n , next_n ) # 8
23+ check (row + (2 * next_n ), col + (2 * next_n ), next_n ) # 9
24+ return
25+
26+ #종이 안의 값이 모두 동일할 때
27+ if curr == - 1 :
28+ minus += 1
29+ elif curr == 0 :
30+ zero += 1
31+ elif curr == 1 :
32+ plus += 1
33+
34+ check (0 , 0 , N )
35+
36+ print (minus )
37+ print (zero )
38+ print (plus )
39+
40+
41+
42+
0 commit comments