結果
問題 | No.1265 Balloon Survival |
ユーザー |
|
提出日時 | 2020-10-23 23:39:51 |
言語 | PyPy3 (7.3.15) |
結果 |
AC
|
実行時間 | 1,792 ms / 2,000 ms |
コード長 | 564 bytes |
コンパイル時間 | 356 ms |
コンパイル使用メモリ | 82,176 KB |
実行使用メモリ | 132,812 KB |
最終ジャッジ日時 | 2024-07-21 13:39:49 |
合計ジャッジ時間 | 21,668 ms |
ジャッジサーバーID (参考情報) |
judge2 / judge4 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 4 |
other | AC * 32 |
ソースコード
n = int(input())x = [0] * ny = [0] * nfor i in range(n):x[i], y[i] = map(int, input().split())def dist(i, j):return (x[j] - x[i]) ** 2 + (y[j] - y[i]) ** 2d = []for i in range(n):for j in range(i + 1, n):if i == j:continued.append((dist(i, j), i, j))d.sort()used = [False] * nans = 0for _, i, j in d:if i == 0:if not used[j]:ans += 1used[j] = Trueelse:if not used[j] and not used[i]:used[i] = Trueused[j] = Trueprint(ans)