結果

問題 No.1265 Balloon Survival
ユーザー FromBooskaFromBooska
提出日時 2023-03-11 08:02:50
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 1,776 ms / 2,000 ms
コード長 763 bytes
コンパイル時間 175 ms
コンパイル使用メモリ 81,800 KB
実行使用メモリ 130,760 KB
最終ジャッジ日時 2023-10-18 09:42:24
合計ジャッジ時間 22,199 ms
ジャッジサーバーID
(参考情報)
judge11 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 40 ms
53,576 KB
testcase_01 AC 37 ms
53,576 KB
testcase_02 AC 37 ms
53,576 KB
testcase_03 AC 39 ms
53,576 KB
testcase_04 AC 39 ms
53,576 KB
testcase_05 AC 39 ms
53,576 KB
testcase_06 AC 39 ms
53,576 KB
testcase_07 AC 38 ms
53,576 KB
testcase_08 AC 38 ms
53,576 KB
testcase_09 AC 39 ms
53,576 KB
testcase_10 AC 38 ms
53,576 KB
testcase_11 AC 39 ms
53,576 KB
testcase_12 AC 38 ms
53,576 KB
testcase_13 AC 38 ms
53,576 KB
testcase_14 AC 173 ms
74,024 KB
testcase_15 AC 139 ms
70,564 KB
testcase_16 AC 75 ms
64,044 KB
testcase_17 AC 803 ms
100,192 KB
testcase_18 AC 95 ms
67,152 KB
testcase_19 AC 78 ms
64,196 KB
testcase_20 AC 171 ms
74,020 KB
testcase_21 AC 393 ms
95,108 KB
testcase_22 AC 218 ms
77,668 KB
testcase_23 AC 240 ms
78,444 KB
testcase_24 AC 1,735 ms
128,776 KB
testcase_25 AC 1,740 ms
129,756 KB
testcase_26 AC 1,730 ms
130,720 KB
testcase_27 AC 1,745 ms
129,728 KB
testcase_28 AC 1,705 ms
130,732 KB
testcase_29 AC 1,776 ms
130,652 KB
testcase_30 AC 1,739 ms
130,760 KB
testcase_31 AC 1,721 ms
129,720 KB
testcase_32 AC 1,754 ms
129,788 KB
testcase_33 AC 1,720 ms
129,760 KB
testcase_34 AC 39 ms
53,576 KB
testcase_35 AC 38 ms
53,576 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