여름의 서재

[SWEA] 4836_색칠하기 본문

알고리즘/SWEA

[SWEA] 4836_색칠하기

엉아_ 2021. 8. 13. 00:34
728x90
T = int(input())

for tc in range(T):
    matrix = [[0]*10 for _ in range(10)]

    N = int(input())
    for _ in range(N):
        x1, y1, x2, y2, color = map(int, input().split())

        if color == 1:
            for i in range(x1, x2+1):
                for j in range(y1, y2+1):
                    matrix[i][j] += 1
        else:
            for i in range(x1, x2+1):
                for j in range(y1, y2+1):
                    matrix[i][j] += 1

        cnt = 0
        for i in range(10):
            for j in range(10):
                if matrix[i][j] == 2:
                    cnt += 1

    print('#{0} {1}'.format(tc+1, cnt))

'알고리즘 > SWEA' 카테고리의 다른 글

[SWEA] 1221_GNS  (0) 2021.08.17
[SWEA] 1210_Ladder1  (0) 2021.08.13
[SWEA] 2001_파리 퇴치  (0) 2021.08.13
[SWEA] 4837_부분집합의 합  (0) 2021.08.13
[SWEA] 1954_달팽이  (0) 2021.08.13
Comments