結果
問題 |
No.1265 Balloon Survival
|
ユーザー |
|
提出日時 | 2020-12-03 23:37:55 |
言語 | Python3 (3.13.1 + numpy 2.2.1 + scipy 1.14.1) |
結果 |
WA
|
実行時間 | - |
コード長 | 778 bytes |
コンパイル時間 | 236 ms |
コンパイル使用メモリ | 12,672 KB |
実行使用メモリ | 11,136 KB |
最終ジャッジ日時 | 2024-09-14 09:01:24 |
合計ジャッジ時間 | 6,003 ms |
ジャッジサーバーID (参考情報) |
judge2 / judge3 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 4 |
other | AC * 11 WA * 21 |
ソースコード
def distance(X, Y): return abs(X[0] - Y[0])**2 + abs(X[1] - Y[1])**2 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))