結果

問題 No.1265 Balloon Survival
ユーザー FromBooskaFromBooska
提出日時 2023-03-10 23:22:02
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 1,789 ms / 2,000 ms
コード長 763 bytes
コンパイル時間 371 ms
コンパイル使用メモリ 81,756 KB
実行使用メモリ 130,620 KB
最終ジャッジ日時 2023-10-18 09:10:16
合計ジャッジ時間 22,257 ms
ジャッジサーバーID
(参考情報)
judge14 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 38 ms
53,432 KB
testcase_01 AC 37 ms
53,432 KB
testcase_02 AC 37 ms
53,432 KB
testcase_03 AC 38 ms
53,432 KB
testcase_04 AC 39 ms
53,432 KB
testcase_05 AC 38 ms
53,432 KB
testcase_06 AC 37 ms
53,432 KB
testcase_07 AC 37 ms
53,432 KB
testcase_08 AC 38 ms
53,432 KB
testcase_09 AC 38 ms
53,432 KB
testcase_10 AC 37 ms
53,432 KB
testcase_11 AC 38 ms
53,432 KB
testcase_12 AC 38 ms
53,432 KB
testcase_13 AC 37 ms
53,432 KB
testcase_14 AC 171 ms
73,880 KB
testcase_15 AC 134 ms
70,420 KB
testcase_16 AC 74 ms
63,896 KB
testcase_17 AC 786 ms
100,084 KB
testcase_18 AC 95 ms
67,008 KB
testcase_19 AC 79 ms
64,048 KB
testcase_20 AC 172 ms
73,876 KB
testcase_21 AC 392 ms
94,984 KB
testcase_22 AC 217 ms
77,524 KB
testcase_23 AC 238 ms
78,300 KB
testcase_24 AC 1,706 ms
128,636 KB
testcase_25 AC 1,682 ms
129,608 KB
testcase_26 AC 1,735 ms
130,588 KB
testcase_27 AC 1,733 ms
129,612 KB
testcase_28 AC 1,734 ms
130,584 KB
testcase_29 AC 1,789 ms
130,620 KB
testcase_30 AC 1,768 ms
130,616 KB
testcase_31 AC 1,746 ms
129,616 KB
testcase_32 AC 1,776 ms
129,616 KB
testcase_33 AC 1,731 ms
129,588 KB
testcase_34 AC 40 ms
53,432 KB
testcase_35 AC 38 ms
53,432 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

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

def main():
    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 and pop[j] == 0:
                pop[j] = 1
                ans += 1
        elif pop[i] == 0 and pop[j] == 0:
                pop[i] = 1
                pop[j] = 1

    print(ans)
    
main()
0