結果

問題 No.1265 Balloon Survival
ユーザー 👑 KazunKazun
提出日時 2021-12-25 03:24:46
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 1,060 ms / 2,000 ms
コード長 662 bytes
コンパイル時間 255 ms
コンパイル使用メモリ 81,564 KB
実行使用メモリ 149,116 KB
最終ジャッジ日時 2023-10-20 08:25:19
合計ジャッジ時間 14,907 ms
ジャッジサーバーID
(参考情報)
judge14 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 42 ms
55,488 KB
testcase_01 AC 41 ms
55,488 KB
testcase_02 AC 41 ms
55,488 KB
testcase_03 AC 40 ms
55,488 KB
testcase_04 AC 40 ms
55,488 KB
testcase_05 AC 40 ms
55,488 KB
testcase_06 AC 41 ms
55,488 KB
testcase_07 AC 40 ms
55,488 KB
testcase_08 AC 40 ms
55,488 KB
testcase_09 AC 41 ms
55,488 KB
testcase_10 AC 43 ms
55,488 KB
testcase_11 AC 41 ms
55,488 KB
testcase_12 AC 40 ms
55,488 KB
testcase_13 AC 40 ms
55,488 KB
testcase_14 AC 143 ms
76,340 KB
testcase_15 AC 102 ms
74,800 KB
testcase_16 AC 66 ms
68,088 KB
testcase_17 AC 551 ms
114,896 KB
testcase_18 AC 76 ms
69,216 KB
testcase_19 AC 67 ms
68,240 KB
testcase_20 AC 120 ms
76,248 KB
testcase_21 AC 233 ms
95,516 KB
testcase_22 AC 173 ms
88,592 KB
testcase_23 AC 195 ms
90,176 KB
testcase_24 AC 1,001 ms
148,588 KB
testcase_25 AC 1,029 ms
148,584 KB
testcase_26 AC 1,060 ms
138,292 KB
testcase_27 AC 1,002 ms
148,592 KB
testcase_28 AC 997 ms
149,112 KB
testcase_29 AC 1,054 ms
149,108 KB
testcase_30 AC 960 ms
149,116 KB
testcase_31 AC 995 ms
148,588 KB
testcase_32 AC 1,049 ms
148,588 KB
testcase_33 AC 1,010 ms
138,144 KB
testcase_34 AC 41 ms
55,508 KB
testcase_35 AC 40 ms
55,508 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

from collections import deque
from operator import itemgetter

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=itemgetter(0))
    Q=deque(Q)
    Flag=[1]*N

    X=0
    for _,j,i in Q:
        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