結果
問題 |
No.1265 Balloon Survival
|
ユーザー |
![]() |
提出日時 | 2021-01-11 19:07:30 |
言語 | PyPy3 (7.3.15) |
結果 |
AC
|
実行時間 | 1,661 ms / 2,000 ms |
コード長 | 562 bytes |
コンパイル時間 | 286 ms |
コンパイル使用メモリ | 82,688 KB |
実行使用メモリ | 133,260 KB |
最終ジャッジ日時 | 2024-11-21 09:18:50 |
合計ジャッジ時間 | 20,524 ms |
ジャッジサーバーID (参考情報) |
judge2 / judge4 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 4 |
other | AC * 32 |
ソースコード
import sys input = sys.stdin.buffer.readline sys.setrecursionlimit(10 ** 7) N = int(input()) XY = tuple(tuple(map(int, input().split())) for _ in range(N)) dist = [] for i, (x, y) in enumerate(XY): for j, (xx, yy) in enumerate(XY): if j >= i: break d = (x - xx) ** 2 + (y - yy) ** 2 dist.append((d, j, i)) seen = [0] * N ans = 0 dist.sort() for d, i, j in dist: if seen[i] or seen[j]: continue if i == 0: seen[j] = 1 ans += 1 else: seen[i] = 1 seen[j] = 1 print(ans)