結果

問題 No.1265 Balloon Survival
ユーザー proriboneproribone
提出日時 2020-10-24 00:22:49
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 1,529 ms / 2,000 ms
コード長 686 bytes
コンパイル時間 334 ms
コンパイル使用メモリ 87,036 KB
実行使用メモリ 111,396 KB
最終ジャッジ日時 2023-09-28 19:33:48
合計ジャッジ時間 21,045 ms
ジャッジサーバーID
(参考情報)
judge13 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 75 ms
71,476 KB
testcase_01 AC 74 ms
71,484 KB
testcase_02 AC 76 ms
71,424 KB
testcase_03 AC 75 ms
71,456 KB
testcase_04 AC 75 ms
71,480 KB
testcase_05 AC 77 ms
71,404 KB
testcase_06 AC 76 ms
71,164 KB
testcase_07 AC 76 ms
71,284 KB
testcase_08 AC 76 ms
71,100 KB
testcase_09 AC 75 ms
71,364 KB
testcase_10 AC 76 ms
71,272 KB
testcase_11 AC 77 ms
71,340 KB
testcase_12 AC 75 ms
71,376 KB
testcase_13 AC 75 ms
71,348 KB
testcase_14 AC 221 ms
81,788 KB
testcase_15 AC 180 ms
80,296 KB
testcase_16 AC 115 ms
77,268 KB
testcase_17 AC 768 ms
100,896 KB
testcase_18 AC 136 ms
78,664 KB
testcase_19 AC 121 ms
77,532 KB
testcase_20 AC 216 ms
81,736 KB
testcase_21 AC 396 ms
88,220 KB
testcase_22 AC 262 ms
83,428 KB
testcase_23 AC 285 ms
84,468 KB
testcase_24 AC 1,507 ms
111,244 KB
testcase_25 AC 1,498 ms
111,204 KB
testcase_26 AC 1,507 ms
111,352 KB
testcase_27 AC 1,508 ms
111,132 KB
testcase_28 AC 1,500 ms
111,244 KB
testcase_29 AC 1,529 ms
111,380 KB
testcase_30 AC 1,522 ms
111,396 KB
testcase_31 AC 1,481 ms
111,236 KB
testcase_32 AC 1,497 ms
111,356 KB
testcase_33 AC 1,496 ms
111,316 KB
testcase_34 AC 78 ms
70,944 KB
testcase_35 AC 75 ms
71,160 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import sys
input=sys.stdin.readline

def dist(p,q):
    a,b=p[0]-q[0],p[1]-q[1]
    return a**2+b**2

def off(a,b):
    return a*10**9+b
def get(x):
    return x%10**9,x//10**9

N=int(input())
point=[tuple(map(int,input().split())) for _ in range(N)]
G=[]

isv=[True]*N

for i in range(N):
    for j in range(i+1,N):
        G.append((dist(point[i],point[j]),off(i,j)))
G.sort()
res=0
for d,x in G:
    i,j=get(x)
    if i==0:
        if isv[j]:
            res+=1
            isv[j]=False
    if j==0:
        if isv[i]:
            res+=1
            isv[i]=False
    else:
        if not isv[i] or not isv[j]:
            continue
        isv[i]=False
        isv[j]=False
print(res)
0