SW Expert Academy/Programming - Intermediate
2일차 - 색칠하기
hikenny
2023. 12. 8. 21:15
import sys
input = sys.stdin.readline
answer = list()
t = int(input())
for _ in range(t):
n = int(input())
color_map = [[[0 for _ in range(10)] for _ in range(10)] for _ in range(2)]
for _ in range(n):
r1, c1, r2, c2, color = map(int, input().split())
color -= 1
for i in range(r1, r2+1):
for j in range(c1, c2+1):
color_map[color][i][j] = 1
cnt = 0
for i in range(10):
for j in range(10):
if color_map[0][i][j]+color_map[1][i][j] == 2:
cnt += 1
answer.append(cnt)
for i in range(t):
print(f"#{i+1} {answer[i]}")
텐서(tensor) 형태로 리스트 생성 후 무식하게 color1 배열이랑 color2 배열에 다 표시하고 비교해서 구했다 ㅎㅎ
참고로 SWEA는 import sys하면 안된다..