結果

問題 No.1265 Balloon Survival
コンテスト
ユーザー aqua_tenhou
提出日時 2020-10-23 22:19:07
言語 Python3
(3.14.3 + numpy 2.4.4 + scipy 1.17.1)
コンパイル:
python3 -mpy_compile _filename_
実行:
python3 _filename_
結果
AC  
実行時間 1,034 ms / 2,000 ms
+ 144µs
コード長 508 bytes
記録
記録タグの例:
初AC ショートコード 純ショートコード 純主流ショートコード 最速実行時間
コンパイル時間 603 ms
コンパイル使用メモリ 21,412 KB
実行使用メモリ 113,956 KB
最終ジャッジ日時 2026-08-21 15:41:40
合計ジャッジ時間 17,284 ms
ジャッジサーバーID
(参考情報)
judge2_0 / judge1_0
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 4
other AC * 32
権限があれば一括ダウンロードができます

ソースコード

diff #
raw source code

n = int(input())
z = [list(map(int,input().split())) for _ in range(n)]

dis2 = []

for i in range(n):
    for j in range(i+1,n):
        d = (z[i][0] - z[j][0])**2 + (z[i][1] - z[j][1])**2
        dis2.append([i,j,d])
        
not_exist = set([])
dis2.sort(key= lambda val : val[2])
ans = 0

for i, j, dis in dis2:
    if i in not_exist or j in not_exist:
        pass
    elif i == 0:
        not_exist.add(j)
        ans += 1
    else:
        not_exist.add(i)
        not_exist.add(j)
        
print(ans)
0