結果

問題 No.1065 電柱 / Pole (Easy)
ユーザー c-yanc-yan
提出日時 2020-05-29 21:40:59
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
TLE  
実行時間 -
コード長 703 bytes
コンパイル時間 90 ms
コンパイル使用メモリ 10,864 KB
実行使用メモリ 124,120 KB
最終ジャッジ日時 2023-08-06 00:17:44
合計ジャッジ時間 22,623 ms
ジャッジサーバーID
(参考情報)
judge11 / judge14
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 17 ms
8,768 KB
testcase_01 AC 16 ms
8,752 KB
testcase_02 AC 710 ms
64,996 KB
testcase_03 AC 1,431 ms
102,000 KB
testcase_04 TLE -
testcase_05 AC 932 ms
94,760 KB
testcase_06 AC 918 ms
94,752 KB
testcase_07 AC 258 ms
39,096 KB
testcase_08 AC 1,093 ms
124,120 KB
testcase_09 AC 91 ms
18,552 KB
testcase_10 AC 445 ms
59,976 KB
testcase_11 AC 315 ms
43,912 KB
testcase_12 AC 313 ms
29,352 KB
testcase_13 TLE -
testcase_14 AC 1,340 ms
73,472 KB
testcase_15 TLE -
testcase_16 AC 1,283 ms
44,936 KB
testcase_17 TLE -
testcase_18 AC 830 ms
35,900 KB
testcase_19 TLE -
testcase_20 AC 469 ms
31,324 KB
testcase_21 AC 1,320 ms
41,848 KB
testcase_22 AC 1,688 ms
79,856 KB
testcase_23 AC 31 ms
9,404 KB
testcase_24 AC 32 ms
9,700 KB
testcase_25 AC 268 ms
26,904 KB
testcase_26 AC 1,224 ms
52,096 KB
testcase_27 AC 969 ms
51,776 KB
testcase_28 AC 1,576 ms
78,668 KB
testcase_29 AC 283 ms
18,712 KB
testcase_30 AC 1,747 ms
85,788 KB
testcase_31 AC 777 ms
63,372 KB
testcase_32 AC 460 ms
44,808 KB
testcase_33 AC 1,089 ms
82,352 KB
testcase_34 AC 670 ms
37,800 KB
testcase_35 AC 1,553 ms
86,204 KB
testcase_36 AC 26 ms
9,052 KB
testcase_37 AC 30 ms
9,640 KB
testcase_38 AC 27 ms
9,356 KB
testcase_39 AC 29 ms
9,752 KB
testcase_40 AC 21 ms
9,000 KB
testcase_41 AC 1,490 ms
123,520 KB
testcase_42 AC 408 ms
44,000 KB
testcase_43 AC 760 ms
69,588 KB
testcase_44 AC 236 ms
31,120 KB
testcase_45 AC 726 ms
68,116 KB
testcase_46 AC 17 ms
8,788 KB
testcase_47 AC 16 ms
8,628 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

from math import sqrt
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] + sqrt((a - c) * (a -c) + (b - d) * (b - d))
        if k < t[j]:
            t[j] = k
            q.append(j)
print(t[Y])
0