結果
問題 | No.1265 Balloon Survival |
ユーザー |
👑 |
提出日時 | 2022-04-03 21:52:50 |
言語 | PyPy3 (7.3.15) |
結果 |
AC
|
実行時間 | 1,771 ms / 2,000 ms |
コード長 | 558 bytes |
コンパイル時間 | 303 ms |
コンパイル使用メモリ | 82,560 KB |
実行使用メモリ | 133,796 KB |
最終ジャッジ日時 | 2024-11-24 05:32:09 |
合計ジャッジ時間 | 22,351 ms |
ジャッジサーバーID (参考情報) |
judge4 / judge5 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 4 |
other | AC * 32 |
ソースコード
import sysinput = sys.stdin.readlinen = int(input())X = [0] * nY = [0] * nfor i in range(n):X[i], Y[i] = map(int, input().split())dist = []for i in range(n):for j in range(i + 1, n):dx = X[j] - X[i]dy = Y[j] - Y[i]dist.append((dx ** 2 + dy ** 2, i, j))dist.sort()used = [False] * nans = 0for _, i, j in dist:if i == 0:if not used[j]:ans += 1used[j] = Trueelif not used[i] and not used[j]:used[i] = used[j] = Trueelse:passprint(ans)