practivceAlgorithm/백준

[백준][Python] 10163 색종이

findTheValue 2021. 8. 29. 00:05

색종이 덧칠하고 순회하며 갯수 세줬습니다.

 

import sys
input = sys.stdin.readline

N = int(input())
matrix = [[0]*1001 for _ in range(1001)]
for k in range(1,N+1):
    x,y,w,h = map(int, input().split())
    for i in range(x,x+w):
        for j in range(y,y+h):
            matrix[i][j] = k
cnt_color = [0] * (N+1)
for i in range(1001):
    for j in range(1001):
        if matrix[i][j]:
            cnt_color[matrix[i][j]] += 1

for i in range(1,N+1):
    print(cnt_color[i])

'practivceAlgorithm > 백준' 카테고리의 다른 글

[백준][Python] 14696 딱지놀이  (0) 2021.08.29
[백준][Python] 13300 방배정  (0) 2021.08.29
[백준][Python] 10158 개미  (0) 2021.08.28
[백준][Python] 10157 자리배정  (0) 2021.08.28
[백준][Python] 2527 직사각형  (0) 2021.08.28