Compy's Blog
74 words
1 minutes
[NYPC] 1차 2번 무한 길이 물풍선
2024-11-06

pro

딱히 설명이 필요하지 않은거 같다.

def count_explosion_lines():
    N = int(input())
    x_coords = {}
    y_coords = {}

    for _ in range(N):
        x, y = map(int, input().split())
        x_coords[x] = x_coords.get(x, 0) + 1
        y_coords[y] = y_coords.get(y, 0) + 1

    vertical_lines = sum(1 for count in x_coords.values() if count >= 2)
    horizontal_lines = sum(1 for count in y_coords.values() if count >= 2)

    return vertical_lines + horizontal_lines


print(count_explosion_lines())
[NYPC] 1차 2번 무한 길이 물풍선
https://compy07.github.io/Blog/posts/algorithms/nypc/2024/first/2/
Author
뒹굴뒹굴 이정훈 공부방
Published at
2024-11-06