結果

問題 No.1265 Balloon Survival
ユーザー NatsubiSoganNatsubiSogan
提出日時 2020-10-23 22:33:00
言語 Python3
(3.11.6 + numpy 1.26.0 + scipy 1.11.3)
結果
AC  
実行時間 1,497 ms / 2,000 ms
コード長 488 bytes
コンパイル時間 299 ms
コンパイル使用メモリ 10,932 KB
実行使用メモリ 84,712 KB
最終ジャッジ日時 2023-09-28 16:40:28
合計ジャッジ時間 18,601 ms
ジャッジサーバーID
(参考情報)
judge12 / judge11
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 17 ms
7,808 KB
testcase_01 AC 16 ms
7,960 KB
testcase_02 AC 17 ms
7,784 KB
testcase_03 AC 17 ms
7,916 KB
testcase_04 AC 17 ms
7,872 KB
testcase_05 AC 17 ms
7,796 KB
testcase_06 AC 17 ms
7,808 KB
testcase_07 AC 17 ms
7,796 KB
testcase_08 AC 17 ms
7,916 KB
testcase_09 AC 17 ms
7,936 KB
testcase_10 AC 16 ms
7,864 KB
testcase_11 AC 17 ms
7,792 KB
testcase_12 AC 17 ms
7,912 KB
testcase_13 AC 17 ms
7,876 KB
testcase_14 AC 143 ms
16,244 KB
testcase_15 AC 106 ms
13,948 KB
testcase_16 AC 44 ms
10,108 KB
testcase_17 AC 737 ms
47,860 KB
testcase_18 AC 62 ms
11,300 KB
testcase_19 AC 49 ms
10,464 KB
testcase_20 AC 140 ms
16,176 KB
testcase_21 AC 327 ms
26,836 KB
testcase_22 AC 191 ms
19,544 KB
testcase_23 AC 213 ms
20,656 KB
testcase_24 AC 1,466 ms
83,672 KB
testcase_25 AC 1,458 ms
84,592 KB
testcase_26 AC 1,467 ms
84,592 KB
testcase_27 AC 1,497 ms
84,400 KB
testcase_28 AC 1,461 ms
84,556 KB
testcase_29 AC 1,458 ms
84,640 KB
testcase_30 AC 1,460 ms
84,712 KB
testcase_31 AC 1,458 ms
84,492 KB
testcase_32 AC 1,459 ms
84,540 KB
testcase_33 AC 1,464 ms
84,472 KB
testcase_34 AC 17 ms
7,936 KB
testcase_35 AC 16 ms
7,784 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

n = int(input())
xy = [list(map(int, input().split())) for i in range(n)]
l = []
for i in range(n):
    for j in range(i + 1, n):
        l.append(((xy[i][0] - xy[j][0]) ** 2 + (xy[i][1] - xy[j][1]) ** 2, i, j))
visited = [False] * n
l.sort()
ans = 0
for d, i, j in l:
    if i == 0:
        if not visited[j]:
            ans += 1
            visited[j] = True
    else:
        if not visited[i] and not visited[j]:
            visited[i] = True
            visited[j] = True
print(ans)
0