結果

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

ソースコード

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()

exploded = set()
delete = set()

for i in range(n-1):
    if i in exploded:
        continue
    fd = distance(f, xy[i])
    explotion = False

    for g in range(n-1):
        if g in delete or g == i or g in exploded:
            continue
        d = distance(xy[i], xy[g])
        if fd > d:
            exploded.add(i)
            exploded.add(g)
            explotion = True
            break

    if not explotion:
        delete.add(i)

print(len(delete))
0