結果

問題 No.1265 Balloon Survival
ユーザー brthyyjpbrthyyjp
提出日時 2020-10-23 22:53:29
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 1,891 ms / 2,000 ms
コード長 586 bytes
コンパイル時間 1,205 ms
コンパイル使用メモリ 87,072 KB
実行使用メモリ 155,204 KB
最終ジャッジ日時 2023-09-28 17:24:45
合計ジャッジ時間 24,804 ms
ジャッジサーバーID
(参考情報)
judge13 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 75 ms
71,172 KB
testcase_01 AC 77 ms
71,376 KB
testcase_02 AC 75 ms
71,328 KB
testcase_03 AC 76 ms
71,224 KB
testcase_04 AC 77 ms
71,332 KB
testcase_05 AC 76 ms
71,008 KB
testcase_06 AC 77 ms
71,156 KB
testcase_07 AC 77 ms
71,220 KB
testcase_08 AC 76 ms
71,204 KB
testcase_09 AC 78 ms
71,352 KB
testcase_10 AC 77 ms
71,192 KB
testcase_11 AC 76 ms
71,096 KB
testcase_12 AC 78 ms
71,156 KB
testcase_13 AC 79 ms
71,388 KB
testcase_14 AC 213 ms
80,388 KB
testcase_15 AC 176 ms
78,812 KB
testcase_16 AC 114 ms
76,268 KB
testcase_17 AC 838 ms
102,860 KB
testcase_18 AC 135 ms
77,620 KB
testcase_19 AC 117 ms
76,492 KB
testcase_20 AC 213 ms
80,120 KB
testcase_21 AC 429 ms
93,272 KB
testcase_22 AC 269 ms
81,864 KB
testcase_23 AC 308 ms
92,484 KB
testcase_24 AC 1,799 ms
153,580 KB
testcase_25 AC 1,794 ms
154,348 KB
testcase_26 AC 1,786 ms
155,204 KB
testcase_27 AC 1,891 ms
154,624 KB
testcase_28 AC 1,762 ms
154,920 KB
testcase_29 AC 1,808 ms
154,936 KB
testcase_30 AC 1,803 ms
154,956 KB
testcase_31 AC 1,809 ms
154,588 KB
testcase_32 AC 1,817 ms
154,472 KB
testcase_33 AC 1,807 ms
154,552 KB
testcase_34 AC 77 ms
71,192 KB
testcase_35 AC 74 ms
71,384 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, 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