結果

問題 No.1265 Balloon Survival
ユーザー Mine
提出日時 2020-12-03 23:04:19
言語 Python3
(3.13.1 + numpy 2.2.1 + scipy 1.14.1)
結果
WA  
実行時間 -
コード長 772 bytes
コンパイル時間 208 ms
コンパイル使用メモリ 12,544 KB
実行使用メモリ 11,136 KB
最終ジャッジ日時 2024-09-14 08:26:28
合計ジャッジ時間 4,967 ms
ジャッジサーバーID
(参考情報)
judge3 / judge4
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 4
other AC * 9 WA * 23
権限があれば一括ダウンロードができます

ソースコード

diff #

def distance(X, Y):
    return abs(X[0] - Y[0]) + abs(X[1] - Y[1])

n = int(input())
f = list(map(int, input().split()))
xy = [list(map(int, input().split())) for _ in range(n-1)]
d = []
for i in range(n-1):
    d.append((distance(f, xy[i]), xy[i]))
d.sort()
for i in range(n-1):
    xy[i] = d[i][1]

delete = set()
exploded = set()

for i in range(n-1):
    if i in exploded:
        continue
    fd = distance(f, xy[i])
    MIN = fd
    minIdx = -1
    for g in range(n-1):
        if g in delete or g in exploded or g == i:
            continue
        d = distance(xy[i], xy[g])
        if MIN > d:
            MIN = d
            minIdx = g

    if minIdx == -1:
        delete.add(i)
    else:
        exploded.add(i)
        exploded.add(minIdx)

print(len(delete))
0