結果

問題 No.1265 Balloon Survival
ユーザー taiga000629taiga000629
提出日時 2020-10-24 00:47:21
言語 PyPy3
(7.3.15)
結果
WA  
実行時間 -
コード長 705 bytes
コンパイル時間 330 ms
コンパイル使用メモリ 86,908 KB
実行使用メモリ 131,480 KB
最終ジャッジ日時 2023-09-28 19:49:00
合計ジャッジ時間 25,721 ms
ジャッジサーバーID
(参考情報)
judge13 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 82 ms
71,396 KB
testcase_01 AC 79 ms
71,096 KB
testcase_02 AC 79 ms
71,320 KB
testcase_03 AC 78 ms
70,860 KB
testcase_04 AC 79 ms
71,068 KB
testcase_05 WA -
testcase_06 AC 76 ms
71,276 KB
testcase_07 WA -
testcase_08 AC 77 ms
71,004 KB
testcase_09 AC 79 ms
70,868 KB
testcase_10 AC 76 ms
71,100 KB
testcase_11 AC 78 ms
71,124 KB
testcase_12 WA -
testcase_13 AC 77 ms
71,312 KB
testcase_14 AC 237 ms
83,352 KB
testcase_15 WA -
testcase_16 WA -
testcase_17 WA -
testcase_18 AC 138 ms
79,392 KB
testcase_19 WA -
testcase_20 WA -
testcase_21 WA -
testcase_22 WA -
testcase_23 WA -
testcase_24 WA -
testcase_25 WA -
testcase_26 WA -
testcase_27 WA -
testcase_28 AC 1,912 ms
131,168 KB
testcase_29 WA -
testcase_30 WA -
testcase_31 WA -
testcase_32 AC 1,957 ms
130,192 KB
testcase_33 TLE -
testcase_34 AC 80 ms
71,172 KB
testcase_35 AC 77 ms
71,180 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

n=int(input())
xy=[[0,0] for i in range(n)]
import sys
input=sys.stdin.readline #文字列入力はするな!

for i in range(n):
    x,y=map(int,input().split())

    xy[i][0]=x
    xy[i][1]=y
ans=0

dis=[[0,0,0] for i in range(n*(n-1)//2)]
cnt=0
for i in range(n-1):
    for j in range(i+1,n):
        xi,yi,xj,yj0=xy[i][0],xy[i][1],xy[j][0],xy[j][1]
        dis[cnt][0]=(xi-xj)**2+(xi-xj)**2
        dis[cnt][1]=i
        dis[cnt][2]=j
        cnt+=1
dis.sort()
erase=[0]*(n)
for i in range(len(dis)):
    p,q=dis[i][1],dis[i][2]
    if p==0:
        if erase[q]==0:
            ans+=1
            erase[q]=1
    else:
        if erase[p]==erase[q]==0:
            erase[p] = erase[q]=1

print(ans)

0