結果
| 問題 | No.1265 Balloon Survival |
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2020-12-03 23:41:45 |
| 言語 | PyPy3 (7.3.15) |
| 結果 |
AC
|
| 実行時間 | 1,659 ms / 2,000 ms |
| コード長 | 491 bytes |
| 記録 | |
| コンパイル時間 | 263 ms |
| コンパイル使用メモリ | 82,432 KB |
| 実行使用メモリ | 131,328 KB |
| 最終ジャッジ日時 | 2024-09-14 09:07:47 |
| 合計ジャッジ時間 | 21,000 ms |
|
ジャッジサーバーID (参考情報) |
judge1 / judge3 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 4 |
| other | AC * 32 |
ソースコード
def distance(X, Y):
return abs(X[0] - Y[0])**2 + abs(X[1] - Y[1])**2
n = int(input())
xy = [list(map(int, input().split())) for _ in range(n)]
d = []
for i in range(n):
for g in range(i+1, n):
d.append((distance(xy[i], xy[g]), (i, g)))
d.sort()
cnt = 0
used = [False]*n
for i, x in d:
if used[x[0]] or used[x[1]]:
continue
if x[0] == 0:
cnt += 1
used[x[1]] = True
else:
used[x[0]] = True
used[x[1]] = True
print(cnt)