結果
| 問題 | No.1265 Balloon Survival |
| コンテスト | |
| ユーザー |
paruf4
|
| 提出日時 | 2020-10-24 00:06:51 |
| 言語 | PyPy3 (7.3.17) |
| 結果 |
AC
|
| 実行時間 | 599 ms / 2,000 ms |
| + 835µs | |
| コード長 | 578 bytes |
| 記録 | |
| コンパイル時間 | 221 ms |
| コンパイル使用メモリ | 96,240 KB |
| 実行使用メモリ | 151,048 KB |
| 最終ジャッジ日時 | 2026-08-21 19:57:07 |
| 合計ジャッジ時間 | 10,252 ms |
|
ジャッジサーバーID (参考情報) |
judge3_0 / judge1_0 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 4 |
| other | AC * 32 |
ソースコード
n = int(input())
xy = [tuple(map(int, input().split())) for _ in range(n)]
dist = []
for i in range(n):
x1, y1 = xy[i]
for j in range(i+1, n):
x2, y2 = xy[j]
d = (x1-x2)**2+(y1-y2)**2
dist.append((d, i, j))
dist = sorted(dist, key=lambda x: x[0])
used = set()
res = 0
for _, i, j in dist:
if i == 0:
if j in used:
continue
else:
res += 1
used.add(j)
else:
if i in used or j in used:
continue
else:
used.add(i)
used.add(j)
print(res)
paruf4