結果

問題 No.1065 電柱 / Pole (Easy)
ユーザー c-yanc-yan
提出日時 2020-06-02 22:22:04
言語 Python3
(3.11.6 + numpy 1.26.0 + scipy 1.11.3)
結果
TLE  
実行時間 -
コード長 684 bytes
コンパイル時間 377 ms
コンパイル使用メモリ 10,976 KB
実行使用メモリ 124,080 KB
最終ジャッジ日時 2023-08-16 04:52:58
合計ジャッジ時間 15,141 ms
ジャッジサーバーID
(参考情報)
judge15 / judge12
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 17 ms
8,928 KB
testcase_01 AC 17 ms
8,772 KB
testcase_02 AC 815 ms
65,396 KB
testcase_03 AC 1,434 ms
102,412 KB
testcase_04 TLE -
testcase_05 AC 891 ms
94,524 KB
testcase_06 AC 907 ms
94,612 KB
testcase_07 AC 279 ms
39,112 KB
testcase_08 AC 1,190 ms
124,080 KB
testcase_09 AC 92 ms
18,632 KB
testcase_10 AC 475 ms
60,036 KB
testcase_11 AC 330 ms
43,932 KB
testcase_12 AC 324 ms
29,160 KB
testcase_13 TLE -
testcase_14 AC 1,535 ms
73,456 KB
testcase_15 TLE -
testcase_16 AC 1,590 ms
45,116 KB
testcase_17 TLE -
testcase_18 -- -
testcase_19 -- -
testcase_20 -- -
testcase_21 -- -
testcase_22 -- -
testcase_23 -- -
testcase_24 -- -
testcase_25 -- -
testcase_26 -- -
testcase_27 -- -
testcase_28 -- -
testcase_29 -- -
testcase_30 -- -
testcase_31 -- -
testcase_32 -- -
testcase_33 -- -
testcase_34 -- -
testcase_35 -- -
testcase_36 -- -
testcase_37 -- -
testcase_38 -- -
testcase_39 -- -
testcase_40 -- -
testcase_41 -- -
testcase_42 -- -
testcase_43 -- -
testcase_44 -- -
testcase_45 -- -
testcase_46 -- -
testcase_47 -- -
権限があれば一括ダウンロードができます

ソースコード

diff #

from sys import stdin
from collections import deque

readline = stdin.readline

N, M = map(int, readline().split())
X, Y = map(lambda x: int(x) - 1, readline().split())
pq = [list(map(int, readline().split())) for _ in range(N)]
PQ = [list(map(int, readline().split())) for _ in range(M)]

links = [[] for _ in range(N)]
for P, Q in PQ:
    links[P - 1].append(Q - 1)
    links[Q - 1].append(P - 1)

q = deque([X])
t = [float('inf')] * N
t[X] = 0
while q:
    i = q.popleft()
    for j in links[i]:
        a, b = pq[i]
        c, d = pq[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])
0