結果
| 問題 |
No.1265 Balloon Survival
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2020-11-17 15:15:36 |
| 言語 | PyPy3 (7.3.15) |
| 結果 |
TLE
(最新)
AC
(最初)
|
| 実行時間 | - |
| コード長 | 620 bytes |
| コンパイル時間 | 163 ms |
| コンパイル使用メモリ | 82,448 KB |
| 実行使用メモリ | 145,376 KB |
| 最終ジャッジ日時 | 2024-07-23 08:18:16 |
| 合計ジャッジ時間 | 24,224 ms |
|
ジャッジサーバーID (参考情報) |
judge1 / judge4 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 4 |
| other | AC * 31 TLE * 1 |
ソースコード
import itertools
n = int(input())
balloons = []
for _ in range(n):
x, y = map(int,input().split())
balloons.append((x, y))
dist = []
for a, b in itertools.combinations([i for i in range(n)], 2):
x1, y1 = balloons[a]
x2, y2 = balloons[b]
d = (x2-x1)**2+(y2-y1)**2
dist.append((d, a, b))
dist.sort()
removed = [0]*n
ans = 0
for d in dist:
a = d[1]
b = d[2]
if a == 0:
if removed[b] == 0:
ans += 1
removed[b] = 1
else:
if removed[a] == 0 and removed[b] == 0:
removed[a] = 1
removed[b] = 1
print(ans)