BOJ - 2669 - 직사각형 네개의 합집합의 면적 구하기

Updated:

import sys

def solution():
    Field = [[0 for _ in range(101)] for _ in range(101)]
    for _ in range(4):
        x, y, dx, dy = map(int, sys.stdin.readline().split())

        for i in range(x, dx):
            for j in range(y, dy):
                Field[i][j] = 1

    ret = 0
    for f in Field:
        ret += f.count(1)
    print(ret)

solution()

https://www.acmicpc.net/problem/2669

Categories:

Updated:

Leave a comment