BOJ - 14658 - 하늘에서 별똥별이 빗발친다

Updated:

import sys

def solution():
    N, M, L, K = map(int, sys.stdin.readline().split())

    ret = 0
    star = []
    for _ in range(K):
        x, y = map(int, sys.stdin.readline().split())
        star.append([x, y])

    for i in range(K):
        for j in range(K):
            cnt = 0
            for k in range(K):
                if star[i][0] <= star[k][0] and star[k][0] <= star[i][0] + L and star[j][1] <= star[k][1] and star[k][1] <= star[j][1] + L:
                    cnt += 1
            ret = max(ret, cnt)
    print(K - ret)

solution()

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

Categories:

Updated:

Leave a comment