結果

問題 No.1265 Balloon Survival
ユーザー FromBooskaFromBooska
提出日時 2023-03-10 23:06:32
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 1,839 ms / 2,000 ms
コード長 651 bytes
コンパイル時間 420 ms
コンパイル使用メモリ 81,720 KB
実行使用メモリ 132,200 KB
最終ジャッジ日時 2023-10-18 08:49:13
合計ジャッジ時間 23,530 ms
ジャッジサーバーID
(参考情報)
judge14 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 38 ms
53,396 KB
testcase_01 AC 38 ms
53,396 KB
testcase_02 AC 38 ms
53,396 KB
testcase_03 AC 40 ms
53,396 KB
testcase_04 AC 38 ms
53,396 KB
testcase_05 AC 40 ms
53,396 KB
testcase_06 AC 39 ms
53,396 KB
testcase_07 AC 39 ms
53,396 KB
testcase_08 AC 38 ms
53,396 KB
testcase_09 AC 39 ms
53,396 KB
testcase_10 AC 38 ms
53,396 KB
testcase_11 AC 37 ms
53,396 KB
testcase_12 AC 38 ms
53,396 KB
testcase_13 AC 39 ms
53,396 KB
testcase_14 AC 187 ms
76,032 KB
testcase_15 AC 141 ms
70,504 KB
testcase_16 AC 76 ms
64,124 KB
testcase_17 AC 813 ms
100,800 KB
testcase_18 AC 98 ms
67,092 KB
testcase_19 AC 83 ms
64,276 KB
testcase_20 AC 177 ms
73,972 KB
testcase_21 AC 413 ms
94,244 KB
testcase_22 AC 223 ms
77,608 KB
testcase_23 AC 246 ms
79,056 KB
testcase_24 AC 1,775 ms
130,404 KB
testcase_25 AC 1,768 ms
131,248 KB
testcase_26 AC 1,773 ms
132,188 KB
testcase_27 AC 1,767 ms
131,196 KB
testcase_28 AC 1,786 ms
132,172 KB
testcase_29 AC 1,829 ms
132,200 KB
testcase_30 AC 1,812 ms
132,184 KB
testcase_31 AC 1,822 ms
131,168 KB
testcase_32 AC 1,839 ms
131,252 KB
testcase_33 AC 1,802 ms
131,220 KB
testcase_34 AC 40 ms
53,416 KB
testcase_35 AC 38 ms
53,416 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

# 全点対の距離、昇順で並べる
# popしてなければ両方pop
# 1とpopしていないbaloonであれば取り除く=pop

N = int(input())
XY = []
for i in range(N):
    x, y = map(int, input().split())
    XY.append([x, y])
    
d_list = []
for i in range(N):
    for j in range(i+1, N):
        d = (XY[i][0]-XY[j][0])**2 + (XY[i][1]-XY[j][1])**2
        d_list.append((d, i, j))
d_list.sort()
        
pop = [0]*N
ans = 0
for d, i, j in d_list:
    if i == 0:
        if pop[j] == 0:
            pop[j] = 1
            ans += 1
    else:
        if pop[i] == 0 and pop[j] == 0:
            pop[i] = 1
            pop[j] = 1

print(ans)
0