結果

問題 No.1265 Balloon Survival
ユーザー 👑 KazunKazun
提出日時 2021-03-13 04:05:14
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 1,038 ms / 2,000 ms
コード長 648 bytes
コンパイル時間 246 ms
コンパイル使用メモリ 82,304 KB
実行使用メモリ 149,456 KB
最終ジャッジ日時 2024-04-22 17:25:04
合計ジャッジ時間 13,759 ms
ジャッジサーバーID
(参考情報)
judge2 / judge1
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 46 ms
53,760 KB
testcase_01 AC 41 ms
54,016 KB
testcase_02 AC 41 ms
53,888 KB
testcase_03 AC 40 ms
54,016 KB
testcase_04 AC 41 ms
53,632 KB
testcase_05 AC 42 ms
54,144 KB
testcase_06 AC 42 ms
53,376 KB
testcase_07 AC 42 ms
53,632 KB
testcase_08 AC 41 ms
53,760 KB
testcase_09 AC 41 ms
53,504 KB
testcase_10 AC 40 ms
53,888 KB
testcase_11 AC 42 ms
53,888 KB
testcase_12 AC 41 ms
53,888 KB
testcase_13 AC 42 ms
53,632 KB
testcase_14 AC 122 ms
76,544 KB
testcase_15 AC 109 ms
73,472 KB
testcase_16 AC 72 ms
66,432 KB
testcase_17 AC 531 ms
115,572 KB
testcase_18 AC 76 ms
68,992 KB
testcase_19 AC 76 ms
67,072 KB
testcase_20 AC 131 ms
76,288 KB
testcase_21 AC 238 ms
96,128 KB
testcase_22 AC 174 ms
89,088 KB
testcase_23 AC 218 ms
91,392 KB
testcase_24 AC 987 ms
137,508 KB
testcase_25 AC 965 ms
138,672 KB
testcase_26 AC 986 ms
139,304 KB
testcase_27 AC 971 ms
138,672 KB
testcase_28 AC 1,020 ms
139,420 KB
testcase_29 AC 971 ms
149,456 KB
testcase_30 AC 1,038 ms
139,280 KB
testcase_31 AC 962 ms
138,652 KB
testcase_32 AC 1,011 ms
139,052 KB
testcase_33 AC 980 ms
138,792 KB
testcase_34 AC 43 ms
54,016 KB
testcase_35 AC 41 ms
53,376 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

from collections import deque

import sys
input=sys.stdin.readline

def main():
    N=int(input())
    P=[0]*N

    for i in range(N):
        P[i]=tuple(map(int,input().split()))

    Q=[]
    k=0
    for i in range(N):
        for j in range(i+1,N):
            a,b=P[i][0]-P[j][0],P[i][1]-P[j][1]
            Q.append((a*a+b*b,j,i))

    Q.sort(key=lambda x:x[0])
    Q=deque(Q)
    Flag=[1]*N

    X=0
    while Q:
        _,j,i=Q.popleft()
        if not(Flag[i] and Flag[j]):
            continue

        Flag[j]=0
        if i!=0:
            Flag[i]=0
        else:
            X+=1
    return X

if __name__=="__main__":
    print(main())
0