結果

問題 No.1265 Balloon Survival
ユーザー 👑 timitimi
提出日時 2020-12-18 15:20:17
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 1,918 ms / 2,000 ms
コード長 521 bytes
コンパイル時間 176 ms
コンパイル使用メモリ 81,780 KB
実行使用メモリ 156,756 KB
最終ジャッジ日時 2023-10-21 08:08:53
合計ジャッジ時間 23,515 ms
ジャッジサーバーID
(参考情報)
judge15 / judge9
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 44 ms
55,560 KB
testcase_01 AC 44 ms
55,560 KB
testcase_02 AC 44 ms
55,560 KB
testcase_03 AC 44 ms
55,560 KB
testcase_04 AC 44 ms
55,560 KB
testcase_05 AC 45 ms
55,560 KB
testcase_06 AC 45 ms
55,560 KB
testcase_07 AC 44 ms
55,560 KB
testcase_08 AC 49 ms
55,560 KB
testcase_09 AC 44 ms
55,560 KB
testcase_10 AC 44 ms
55,560 KB
testcase_11 AC 45 ms
55,560 KB
testcase_12 AC 45 ms
55,560 KB
testcase_13 AC 44 ms
55,560 KB
testcase_14 AC 222 ms
76,908 KB
testcase_15 AC 150 ms
73,104 KB
testcase_16 AC 86 ms
68,544 KB
testcase_17 AC 853 ms
104,208 KB
testcase_18 AC 108 ms
69,536 KB
testcase_19 AC 91 ms
68,844 KB
testcase_20 AC 184 ms
76,784 KB
testcase_21 AC 449 ms
96,656 KB
testcase_22 AC 265 ms
90,420 KB
testcase_23 AC 287 ms
92,268 KB
testcase_24 AC 1,875 ms
155,176 KB
testcase_25 AC 1,884 ms
156,228 KB
testcase_26 AC 1,857 ms
156,756 KB
testcase_27 AC 1,848 ms
156,224 KB
testcase_28 AC 1,858 ms
156,492 KB
testcase_29 AC 1,908 ms
156,488 KB
testcase_30 AC 1,870 ms
156,752 KB
testcase_31 AC 1,857 ms
156,228 KB
testcase_32 AC 1,918 ms
156,228 KB
testcase_33 AC 1,851 ms
156,224 KB
testcase_34 AC 46 ms
55,568 KB
testcase_35 AC 44 ms
55,568 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