結果

問題 No.1065 電柱 / Pole (Easy)
ユーザー NagisaNagisa
提出日時 2020-05-29 22:20:35
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
TLE  
実行時間 -
コード長 825 bytes
コンパイル時間 95 ms
コンパイル使用メモリ 10,896 KB
実行使用メモリ 167,092 KB
最終ジャッジ日時 2023-08-06 02:36:04
合計ジャッジ時間 12,346 ms
ジャッジサーバーID
(参考情報)
judge13 / judge12
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 17 ms
12,684 KB
testcase_01 AC 16 ms
8,360 KB
testcase_02 AC 905 ms
66,976 KB
testcase_03 AC 1,104 ms
107,924 KB
testcase_04 AC 1,356 ms
107,936 KB
testcase_05 AC 883 ms
100,640 KB
testcase_06 AC 892 ms
100,756 KB
testcase_07 AC 257 ms
50,272 KB
testcase_08 AC 1,264 ms
167,092 KB
testcase_09 AC 85 ms
21,864 KB
testcase_10 AC 487 ms
78,940 KB
testcase_11 AC 315 ms
56,680 KB
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
sys.setrecursionlimit(200010)
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