結果

問題 No.1265 Balloon Survival
ユーザー nagissnagiss
提出日時 2020-10-23 23:06:54
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
AC  
実行時間 1,001 ms / 2,000 ms
コード長 567 bytes
コンパイル時間 107 ms
コンパイル使用メモリ 10,928 KB
実行使用メモリ 91,540 KB
最終ジャッジ日時 2023-09-28 17:46:33
合計ジャッジ時間 13,573 ms
ジャッジサーバーID
(参考情報)
judge15 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 19 ms
8,012 KB
testcase_01 AC 18 ms
7,872 KB
testcase_02 AC 17 ms
7,876 KB
testcase_03 AC 17 ms
7,876 KB
testcase_04 AC 17 ms
7,928 KB
testcase_05 AC 17 ms
7,932 KB
testcase_06 AC 18 ms
7,828 KB
testcase_07 AC 17 ms
7,884 KB
testcase_08 AC 17 ms
7,804 KB
testcase_09 AC 17 ms
7,816 KB
testcase_10 AC 17 ms
8,012 KB
testcase_11 AC 18 ms
7,980 KB
testcase_12 AC 18 ms
7,824 KB
testcase_13 AC 17 ms
7,972 KB
testcase_14 AC 103 ms
17,080 KB
testcase_15 AC 80 ms
14,740 KB
testcase_16 AC 38 ms
10,408 KB
testcase_17 AC 503 ms
51,600 KB
testcase_18 AC 48 ms
11,836 KB
testcase_19 AC 39 ms
10,900 KB
testcase_20 AC 101 ms
17,132 KB
testcase_21 AC 232 ms
28,440 KB
testcase_22 AC 136 ms
20,788 KB
testcase_23 AC 152 ms
22,092 KB
testcase_24 AC 977 ms
89,820 KB
testcase_25 AC 987 ms
91,540 KB
testcase_26 AC 1,001 ms
91,488 KB
testcase_27 AC 974 ms
91,504 KB
testcase_28 AC 973 ms
91,412 KB
testcase_29 AC 997 ms
91,540 KB
testcase_30 AC 988 ms
91,348 KB
testcase_31 AC 998 ms
91,328 KB
testcase_32 AC 978 ms
91,488 KB
testcase_33 AC 977 ms
91,316 KB
testcase_34 AC 17 ms
8,360 KB
testcase_35 AC 17 ms
7,816 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

from operator import itemgetter

N = int(input())
XY = [list(map(int, input().split())) for _ in range(N)]
A = [((ax-bx)**2+(ay-by)**2, a, b) for a, (ax, ay) in enumerate(XY) for b, (bx, by) in enumerate(XY[a+1:], a+1)]
A.sort(key=itemgetter(0))
ans = 0
Closed = [False] * N
for _, a, b in A:
    if Closed[a] == Closed[b] == False:
        if a != 0 and b != 0:
            Closed[a] = True
            Closed[b] = True
        elif a == 0:
            Closed[b] = True
            ans += 1
        else:
            Closed[a] = True
            ans += 1
print(ans)
0