結果

問題 No.1065 電柱 / Pole (Easy)
ユーザー pluto77pluto77
提出日時 2020-06-19 14:20:34
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 910 ms / 2,000 ms
コード長 530 bytes
コンパイル時間 409 ms
コンパイル使用メモリ 86,868 KB
実行使用メモリ 143,684 KB
最終ジャッジ日時 2023-09-16 12:50:20
合計ジャッジ時間 22,662 ms
ジャッジサーバーID
(参考情報)
judge13 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 90 ms
71,592 KB
testcase_01 AC 88 ms
71,700 KB
testcase_02 AC 403 ms
110,464 KB
testcase_03 AC 464 ms
141,112 KB
testcase_04 AC 477 ms
141,096 KB
testcase_05 AC 442 ms
136,480 KB
testcase_06 AC 439 ms
136,508 KB
testcase_07 AC 229 ms
90,052 KB
testcase_08 AC 475 ms
143,436 KB
testcase_09 AC 174 ms
84,184 KB
testcase_10 AC 310 ms
107,200 KB
testcase_11 AC 242 ms
92,720 KB
testcase_12 AC 225 ms
89,712 KB
testcase_13 AC 602 ms
113,896 KB
testcase_14 AC 546 ms
121,672 KB
testcase_15 AC 706 ms
131,356 KB
testcase_16 AC 404 ms
100,632 KB
testcase_17 AC 910 ms
133,888 KB
testcase_18 AC 321 ms
94,796 KB
testcase_19 AC 852 ms
131,784 KB
testcase_20 AC 305 ms
92,740 KB
testcase_21 AC 394 ms
99,328 KB
testcase_22 AC 722 ms
125,988 KB
testcase_23 AC 135 ms
78,376 KB
testcase_24 AC 141 ms
78,196 KB
testcase_25 AC 213 ms
87,292 KB
testcase_26 AC 535 ms
109,836 KB
testcase_27 AC 475 ms
108,068 KB
testcase_28 AC 653 ms
129,864 KB
testcase_29 AC 200 ms
83,884 KB
testcase_30 AC 719 ms
137,396 KB
testcase_31 AC 454 ms
118,600 KB
testcase_32 AC 343 ms
104,012 KB
testcase_33 AC 556 ms
135,236 KB
testcase_34 AC 342 ms
96,304 KB
testcase_35 AC 726 ms
137,544 KB
testcase_36 AC 137 ms
78,764 KB
testcase_37 AC 152 ms
78,764 KB
testcase_38 AC 136 ms
78,684 KB
testcase_39 AC 152 ms
79,160 KB
testcase_40 AC 118 ms
77,944 KB
testcase_41 AC 759 ms
143,684 KB
testcase_42 AC 309 ms
99,088 KB
testcase_43 AC 433 ms
112,960 KB
testcase_44 AC 246 ms
88,832 KB
testcase_45 AC 432 ms
109,140 KB
testcase_46 AC 93 ms
71,748 KB
testcase_47 AC 90 ms
72,068 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#yuki1065
from collections import deque
from math import sqrt

N,M=map(int,input().split())
X,Y=map(int,input().split())
X-=1
Y-=1
pq=[list(map(int,input().split())) for i in range(N)]
PQ=[list(map(int,input().split())) for i in range(M)]
edge=[[] for i in range(N)]
for P,Q in PQ:
 edge[P-1].append(Q-1)
 edge[Q-1].append(P-1)

q=deque([X])
res=[float('inf')]*N
res[X]=0
while q:
 i=q.popleft()
 for j in edge[i]:
  a,b=pq[i]
  c,d=pq[j]
  k=res[i]+sqrt((a-c)**2+(b-d)**2)
  if k<res[j]:
   res[j]=k
   q.append(j)
print(res[Y])
0