結果

問題 No.1065 電柱 / Pole (Easy)
ユーザー NagisaNagisa
提出日時 2020-05-29 21:53:00
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
RE  
実行時間 -
コード長 796 bytes
コンパイル時間 100 ms
コンパイル使用メモリ 10,992 KB
実行使用メモリ 122,844 KB
最終ジャッジ日時 2023-08-06 01:16:51
合計ジャッジ時間 11,971 ms
ジャッジサーバーID
(参考情報)
judge11 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 17 ms
15,292 KB
testcase_01 AC 16 ms
8,320 KB
testcase_02 AC 869 ms
67,036 KB
testcase_03 AC 1,093 ms
108,148 KB
testcase_04 AC 1,332 ms
108,156 KB
testcase_05 AC 821 ms
100,724 KB
testcase_06 AC 845 ms
100,700 KB
testcase_07 RE -
testcase_08 RE -
testcase_09 RE -
testcase_10 RE -
testcase_11 RE -
testcase_12 TLE -
testcase_13 -- -
testcase_14 -- -
testcase_15 -- -
testcase_16 -- -
testcase_17 -- -
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 #

import sys
from math import sqrt
input = sys.stdin.readline

def main():
    N, M = map(int,input().split())
    X, Y = map(int,input().split())
    X -= 1
    Y -= 1
    D = []
    for _ in range(N):
        D.append(list(map(int,input().split())))
    K = [[] for _ in range(N)]
    for _ in range(M):
        P, Q = map(int,input().split())
        P -= 1
        Q -= 1
        K[P].append([Q,sqrt((D[P][0]-D[Q][0])**2+(D[P][1]-D[Q][1])**2)])
        K[Q].append([P,sqrt((D[P][0]-D[Q][0])**2+(D[P][1]-D[Q][1])**2)])
    V = [float("inf")]*N
    def dfs(ima):
        for tsugi in K[ima]:
            if V[tsugi[0]] > V[ima] + tsugi[1]:
                V[tsugi[0]] = V[ima] + tsugi[1]
                dfs(tsugi[0])
    V[X] = 0
    dfs(X)
    print(V[Y])
if __name__ == '__main__':
    main()
0