結果
問題 |
No.1265 Balloon Survival
|
ユーザー |
![]() |
提出日時 | 2021-01-11 19:15:19 |
言語 | Python3 (3.13.1 + numpy 2.2.1 + scipy 1.14.1) |
結果 |
AC
|
実行時間 | 1,489 ms / 2,000 ms |
コード長 | 562 bytes |
コンパイル時間 | 168 ms |
コンパイル使用メモリ | 12,416 KB |
実行使用メモリ | 81,252 KB |
最終ジャッジ日時 | 2024-11-21 09:19:24 |
合計ジャッジ時間 | 18,145 ms |
ジャッジサーバーID (参考情報) |
judge2 / judge3 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
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 _, 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)