結果

問題 No.1065 電柱 / Pole (Easy)
ユーザー c-yanc-yan
提出日時 2020-06-02 22:18:40
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 904 ms / 2,000 ms
コード長 405 bytes
コンパイル時間 493 ms
コンパイル使用メモリ 82,556 KB
実行使用メモリ 142,704 KB
最終ジャッジ日時 2024-05-03 14:05:26
合計ジャッジ時間 17,595 ms
ジャッジサーバーID
(参考情報)
judge5 / judge3
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 35 ms
54,012 KB
testcase_01 AC 37 ms
54,400 KB
testcase_02 AC 303 ms
105,472 KB
testcase_03 AC 416 ms
135,396 KB
testcase_04 AC 443 ms
135,528 KB
testcase_05 AC 346 ms
141,056 KB
testcase_06 AC 347 ms
141,180 KB
testcase_07 AC 179 ms
92,544 KB
testcase_08 AC 448 ms
142,336 KB
testcase_09 AC 141 ms
82,176 KB
testcase_10 AC 285 ms
102,528 KB
testcase_11 AC 233 ms
97,040 KB
testcase_12 AC 191 ms
89,600 KB
testcase_13 AC 626 ms
114,432 KB
testcase_14 AC 508 ms
120,012 KB
testcase_15 AC 692 ms
128,124 KB
testcase_16 AC 400 ms
100,576 KB
testcase_17 AC 904 ms
133,248 KB
testcase_18 AC 302 ms
93,128 KB
testcase_19 AC 710 ms
132,700 KB
testcase_20 AC 228 ms
88,988 KB
testcase_21 AC 351 ms
97,152 KB
testcase_22 AC 551 ms
122,368 KB
testcase_23 AC 78 ms
77,568 KB
testcase_24 AC 82 ms
77,568 KB
testcase_25 AC 148 ms
87,552 KB
testcase_26 AC 415 ms
107,904 KB
testcase_27 AC 383 ms
107,136 KB
testcase_28 AC 537 ms
128,128 KB
testcase_29 AC 154 ms
83,328 KB
testcase_30 AC 548 ms
129,288 KB
testcase_31 AC 338 ms
113,152 KB
testcase_32 AC 252 ms
99,568 KB
testcase_33 AC 448 ms
129,356 KB
testcase_34 AC 270 ms
92,936 KB
testcase_35 AC 567 ms
135,172 KB
testcase_36 AC 93 ms
77,796 KB
testcase_37 AC 108 ms
78,592 KB
testcase_38 AC 88 ms
77,520 KB
testcase_39 AC 114 ms
78,704 KB
testcase_40 AC 63 ms
70,400 KB
testcase_41 AC 632 ms
142,704 KB
testcase_42 AC 242 ms
95,756 KB
testcase_43 AC 376 ms
110,848 KB
testcase_44 AC 197 ms
90,796 KB
testcase_45 AC 364 ms
110,976 KB
testcase_46 AC 37 ms
53,760 KB
testcase_47 AC 38 ms
53,888 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

from collections import deque
r=lambda:list(map(int,input().split()))
N,M=r()
X,Y=r()
p=[r() for _ in range(N)]
P=[r() for _ in range(M)]
l=[[]for _ in range(N)]
for a,b in P:
	l[a-1].append(b-1)
	l[b-1].append(a-1)
q=deque([X-1])
t=[1e20]*N
t[X-1]=0
while q:
	i=q.popleft()
	for j in l[i]:
		a,b=p[i]
		c,d=p[j]
		k=t[i]+((a-c)*(a-c)+(b-d)*(b-d))**0.5
		if k<t[j]:
			t[j]=k
			q.append(j)
print(t[Y-1])
0