結果

問題 No.1265 Balloon Survival
ユーザー 👑 KazunKazun
提出日時 2020-10-24 15:18:28
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 1,146 ms / 2,000 ms
コード長 694 bytes
コンパイル時間 326 ms
コンパイル使用メモリ 86,824 KB
実行使用メモリ 131,328 KB
最終ジャッジ日時 2023-09-28 20:28:20
合計ジャッジ時間 16,052 ms
ジャッジサーバーID
(参考情報)
judge13 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 98 ms
71,428 KB
testcase_01 AC 97 ms
71,420 KB
testcase_02 AC 98 ms
71,448 KB
testcase_03 AC 96 ms
71,584 KB
testcase_04 AC 97 ms
71,556 KB
testcase_05 AC 96 ms
71,464 KB
testcase_06 AC 94 ms
71,508 KB
testcase_07 AC 97 ms
71,388 KB
testcase_08 AC 95 ms
71,556 KB
testcase_09 AC 98 ms
71,532 KB
testcase_10 AC 98 ms
71,516 KB
testcase_11 AC 97 ms
71,572 KB
testcase_12 AC 99 ms
71,560 KB
testcase_13 AC 97 ms
71,512 KB
testcase_14 AC 181 ms
78,648 KB
testcase_15 AC 157 ms
78,480 KB
testcase_16 AC 124 ms
77,172 KB
testcase_17 AC 518 ms
103,692 KB
testcase_18 AC 136 ms
77,704 KB
testcase_19 AC 126 ms
77,076 KB
testcase_20 AC 174 ms
78,768 KB
testcase_21 AC 277 ms
80,460 KB
testcase_22 AC 204 ms
79,380 KB
testcase_23 AC 213 ms
79,600 KB
testcase_24 AC 1,037 ms
129,460 KB
testcase_25 AC 1,046 ms
130,428 KB
testcase_26 AC 1,046 ms
131,184 KB
testcase_27 AC 1,001 ms
130,424 KB
testcase_28 AC 1,028 ms
130,916 KB
testcase_29 AC 1,059 ms
131,328 KB
testcase_30 AC 1,025 ms
131,296 KB
testcase_31 AC 1,046 ms
130,424 KB
testcase_32 AC 1,146 ms
130,956 KB
testcase_33 AC 1,098 ms
130,656 KB
testcase_34 AC 97 ms
71,424 KB
testcase_35 AC 94 ms
71,704 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=[0]*(N*(N-1)//2)
    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[k]=(a*a+b*b,j,i)
            k+=1

    Q.sort(key=lambda x:x[0])
    Q=deque(Q)
    Flag=[True for _ in range(N)]

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

        Flag[j]=False
        if i!=0:
            Flag[i]=False
        else:
            X+=1
    print(X)

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