- 메모리 : 29200 KB
- 시간 : 92 ms
def count(x, y, n):
global white, blue
color = matrix[x][y]
for i in range(x, x+n):
for j in range(y, y+n):
if color != matrix[i][j]:
count(x, y, n//2)
count(x, y+n//2, n//2)
count(x+n//2, y, n//2)
count(x+n//2, y+n//2, n//2)
return
if color == 0 :
white += 1
else :
blue += 1
n = int(input())
matrix = [list(map(int, input().split())) for i in range(n)]
white, blue = 0, 0
count(0,0,n)
print(white)
print(blue)