結果

問題 No.1265 Balloon Survival
ユーザー brthyyjpbrthyyjp
提出日時 2020-10-23 22:58:00
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 1,579 ms / 2,000 ms
コード長 616 bytes
コンパイル時間 345 ms
コンパイル使用メモリ 87,212 KB
実行使用メモリ 107,888 KB
最終ジャッジ日時 2023-09-28 17:28:09
合計ジャッジ時間 21,882 ms
ジャッジサーバーID
(参考情報)
judge15 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 77 ms
71,096 KB
testcase_01 AC 77 ms
71,052 KB
testcase_02 AC 77 ms
71,344 KB
testcase_03 AC 76 ms
71,556 KB
testcase_04 AC 78 ms
71,056 KB
testcase_05 AC 78 ms
71,332 KB
testcase_06 AC 80 ms
71,368 KB
testcase_07 AC 79 ms
71,200 KB
testcase_08 AC 78 ms
71,128 KB
testcase_09 AC 77 ms
71,460 KB
testcase_10 AC 77 ms
71,060 KB
testcase_11 AC 78 ms
71,368 KB
testcase_12 AC 78 ms
70,988 KB
testcase_13 AC 77 ms
71,412 KB
testcase_14 AC 225 ms
81,668 KB
testcase_15 AC 185 ms
80,412 KB
testcase_16 AC 116 ms
77,376 KB
testcase_17 AC 794 ms
100,352 KB
testcase_18 AC 139 ms
78,452 KB
testcase_19 AC 122 ms
77,608 KB
testcase_20 AC 221 ms
81,608 KB
testcase_21 AC 399 ms
87,628 KB
testcase_22 AC 275 ms
82,992 KB
testcase_23 AC 292 ms
84,224 KB
testcase_24 AC 1,560 ms
107,444 KB
testcase_25 AC 1,537 ms
107,756 KB
testcase_26 AC 1,548 ms
107,604 KB
testcase_27 AC 1,556 ms
107,824 KB
testcase_28 AC 1,579 ms
107,844 KB
testcase_29 AC 1,569 ms
107,592 KB
testcase_30 AC 1,554 ms
107,648 KB
testcase_31 AC 1,563 ms
107,888 KB
testcase_32 AC 1,561 ms
107,768 KB
testcase_33 AC 1,528 ms
107,392 KB
testcase_34 AC 77 ms
71,172 KB
testcase_35 AC 77 ms
71,500 KB
権限があれば一括ダウンロードができます

ソースコード

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 = (x1-x2)**2+(y1-y2)**2
        T.append((d, i*10000+j))

T.sort()
#print(T)
used = set()
ans = 0
for d, k in T:
    i, j = divmod(k, 10000)
    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