結果
問題 |
No.1265 Balloon Survival
|
ユーザー |
👑 |
提出日時 | 2022-01-18 21:16:28 |
言語 | PyPy3 (7.3.15) |
結果 |
AC
|
実行時間 | 1,647 ms / 2,000 ms |
コード長 | 483 bytes |
コンパイル時間 | 434 ms |
コンパイル使用メモリ | 82,700 KB |
実行使用メモリ | 152,444 KB |
最終ジャッジ日時 | 2024-11-23 13:29:42 |
合計ジャッジ時間 | 20,236 ms |
ジャッジサーバーID (参考情報) |
judge3 / judge1 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 4 |
other | AC * 32 |
ソースコード
n = int(input()) xy = [list(map(int, input().split())) for _ in range(n)] dist = [] for i in range(n): for j in range(i + 1, n): dx = xy[j][0] - xy[i][0] dy = xy[j][1] - xy[i][1] dist.append((dx ** 2 + dy ** 2, i, j)) dist.sort() used = [False] * n ans = 0 for _, i, j in dist: if i == 0: if not used[j]: ans += 1 used[j] = True elif not used[i] and not used[j]: used[i] = used[j] = True print(ans)