結果

問題 No.1265 Balloon Survival
コンテスト
ユーザー brthyyjp
提出日時 2020-10-23 22:50:42
言語 PyPy3
(7.3.15)
結果
TLE  
実行時間 -
コード長 591 bytes
コンパイル時間 244 ms
コンパイル使用メモリ 81,984 KB
実行使用メモリ 150,976 KB
最終ジャッジ日時 2024-07-21 11:58:25
合計ジャッジ時間 11,011 ms
ジャッジサーバーID
(参考情報)
judge1 / judge3
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 4
other AC * 21 WA * 1 TLE * 10
権限があれば一括ダウンロードができます

ソースコード

diff #

n = int(input())
XY = []
for i in range(n):
    x, y = map(int, input().split())
    XY.append((x, y))

if n == 1:
    print(0)
    exit()

import math
INF = float('inf')
T = []
for i in range(n-1):
    x1, y1=XY[i]
    for j in range(i+1, n):
        x2,y2 = XY[j]
        d = math.hypot(x1-x2, y1-y2)/2
        T.append((d, i, j))

T.sort()
#print(T)
used = set()
ans = 0
for d, i, j in T:
    if i == 0:
        if j not in used:
            ans += 1
            used.add(j)
    else:
        if i not in used and j not in used:
            used.add(i)
            used.add(j)
print(ans)
0