알고리즘 문제 풀기/SWEA

SWEA 4836. 색칠하기 2차원 배열(파이썬)

hibscus 2021. 2. 16. 23:28

SWEA 4836

 

문제의 저작권은 SW Expert Academy에 있습니다

 

 

 

 

 

 

 

 

T = int(input())
for tc in range(1, T+1):
    N = int(input())
    arr = [[0] * 10 for i in range(10)]

    for i in range(N):
        sketch = list(map(int, input().split()))
        for i in range(sketch[0], sketch[2]+1):
            for j in range(sketch[1], sketch[3]+1):
                arr[i][j] += sketch[4]

    count = 0
    for i in range(10):
        for j in range(10):
            if arr[i][j] == 3:
                count += 1
    print(f'#{tc} {count}')