結果

問題 No.1265 Balloon Survival
ユーザー 👑 timitimi
提出日時 2020-12-18 15:20:38
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
AC  
実行時間 1,580 ms / 2,000 ms
コード長 521 bytes
コンパイル時間 216 ms
コンパイル使用メモリ 11,980 KB
実行使用メモリ 75,768 KB
最終ジャッジ日時 2023-10-21 08:09:17
合計ジャッジ時間 19,542 ms
ジャッジサーバーID
(参考情報)
judge10 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 28 ms
10,152 KB
testcase_01 AC 28 ms
10,152 KB
testcase_02 AC 28 ms
10,152 KB
testcase_03 AC 28 ms
10,152 KB
testcase_04 AC 27 ms
10,152 KB
testcase_05 AC 26 ms
10,164 KB
testcase_06 AC 25 ms
10,156 KB
testcase_07 AC 25 ms
10,156 KB
testcase_08 AC 25 ms
10,156 KB
testcase_09 AC 25 ms
10,152 KB
testcase_10 AC 25 ms
10,152 KB
testcase_11 AC 27 ms
10,160 KB
testcase_12 AC 30 ms
10,164 KB
testcase_13 AC 27 ms
10,156 KB
testcase_14 AC 178 ms
18,084 KB
testcase_15 AC 126 ms
15,960 KB
testcase_16 AC 61 ms
12,256 KB
testcase_17 AC 727 ms
44,620 KB
testcase_18 AC 78 ms
13,304 KB
testcase_19 AC 62 ms
12,520 KB
testcase_20 AC 141 ms
17,820 KB
testcase_21 AC 324 ms
26,772 KB
testcase_22 AC 192 ms
20,564 KB
testcase_23 AC 218 ms
21,536 KB
testcase_24 AC 1,536 ms
74,880 KB
testcase_25 AC 1,481 ms
75,672 KB
testcase_26 AC 1,545 ms
75,768 KB
testcase_27 AC 1,580 ms
75,672 KB
testcase_28 AC 1,533 ms
75,768 KB
testcase_29 AC 1,495 ms
75,768 KB
testcase_30 AC 1,515 ms
75,768 KB
testcase_31 AC 1,545 ms
75,672 KB
testcase_32 AC 1,529 ms
75,672 KB
testcase_33 AC 1,512 ms
75,672 KB
testcase_34 AC 25 ms
10,176 KB
testcase_35 AC 24 ms
10,152 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import sys
input=sys.stdin.readline
N=int(input())
A=[]
for i in range(N):
  x,y=map(int, input().split())
  A.append((x,y,i))
B=[]
for i in range(N-1):
  for j in range(i+1,N):
    ax,ay,an=A[i][0],A[i][1],A[i][2]
    bx,by,bn=A[j][0],A[j][1],A[j][2]
    d=(ax-bx)**2+(ay-by)**2
    B.append((d,an,bn))
B=sorted(B)
ans=0
D=[1]*N
from collections import deque
d=deque(B)
while d:
  a,an,bn=d.popleft()
  if D[an]==1 and D[bn]==1:
    if an==0:
      ans+=1
      D[bn]=0
    else:
      D[an]=0
      D[bn]=0  
print(ans)
0