結果

問題 No.1265 Balloon Survival
ユーザー MineMine
提出日時 2020-12-03 23:41:03
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
AC  
実行時間 1,668 ms / 2,000 ms
コード長 491 bytes
コンパイル時間 91 ms
コンパイル使用メモリ 10,836 KB
実行使用メモリ 116,036 KB
最終ジャッジ日時 2023-10-12 10:12:32
合計ジャッジ時間 20,636 ms
ジャッジサーバーID
(参考情報)
judge12 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 16 ms
7,892 KB
testcase_01 AC 16 ms
7,784 KB
testcase_02 AC 15 ms
7,856 KB
testcase_03 AC 15 ms
7,788 KB
testcase_04 AC 16 ms
7,816 KB
testcase_05 AC 17 ms
7,896 KB
testcase_06 AC 16 ms
7,828 KB
testcase_07 AC 16 ms
7,988 KB
testcase_08 AC 16 ms
7,816 KB
testcase_09 AC 15 ms
7,912 KB
testcase_10 AC 15 ms
7,936 KB
testcase_11 AC 16 ms
7,804 KB
testcase_12 AC 16 ms
7,784 KB
testcase_13 AC 16 ms
7,820 KB
testcase_14 AC 146 ms
20,144 KB
testcase_15 AC 104 ms
16,796 KB
testcase_16 AC 45 ms
11,360 KB
testcase_17 AC 790 ms
64,516 KB
testcase_18 AC 61 ms
12,832 KB
testcase_19 AC 48 ms
11,740 KB
testcase_20 AC 140 ms
19,800 KB
testcase_21 AC 346 ms
35,052 KB
testcase_22 AC 200 ms
24,612 KB
testcase_23 AC 222 ms
26,076 KB
testcase_24 AC 1,668 ms
115,016 KB
testcase_25 AC 1,657 ms
115,808 KB
testcase_26 AC 1,631 ms
115,908 KB
testcase_27 AC 1,622 ms
115,884 KB
testcase_28 AC 1,632 ms
115,988 KB
testcase_29 AC 1,646 ms
116,036 KB
testcase_30 AC 1,650 ms
115,992 KB
testcase_31 AC 1,631 ms
116,024 KB
testcase_32 AC 1,643 ms
115,980 KB
testcase_33 AC 1,614 ms
115,900 KB
testcase_34 AC 16 ms
7,788 KB
testcase_35 AC 15 ms
7,780 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

def distance(X, Y):
    return abs(X[0] - Y[0])**2 + abs(X[1] - Y[1])**2

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

for i in range(n):
    for g in range(i+1, n):
        d.append((distance(xy[i], xy[g]), (i, g)))
d.sort()

cnt = 0
used = [False]*n

for i, x in d:
    if used[x[0]] or used[x[1]]:
        continue
    if x[0] == 0:
        cnt += 1
        used[x[1]] = True
    else:
        used[x[0]] = True
        used[x[1]] = True

print(cnt)

0