結果

問題 No.1065 電柱 / Pole (Easy)
ユーザー H3PO4H3PO4
提出日時 2020-05-29 21:42:52
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
TLE  
(最新)
AC  
(最初)
実行時間 -
コード長 538 bytes
コンパイル時間 130 ms
コンパイル使用メモリ 12,544 KB
実行使用メモリ 122,300 KB
最終ジャッジ日時 2024-04-23 20:56:12
合計ジャッジ時間 88,342 ms
ジャッジサーバーID
(参考情報)
judge2 / judge4
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 957 ms
56,268 KB
testcase_01 AC 923 ms
56,396 KB
testcase_02 TLE -
testcase_03 TLE -
testcase_04 TLE -
testcase_05 TLE -
testcase_06 TLE -
testcase_07 AC 1,426 ms
70,852 KB
testcase_08 TLE -
testcase_09 AC 1,113 ms
58,696 KB
testcase_10 AC 1,853 ms
83,668 KB
testcase_11 AC 1,549 ms
73,412 KB
testcase_12 AC 1,478 ms
64,840 KB
testcase_13 TLE -
testcase_14 TLE -
testcase_15 TLE -
testcase_16 AC 1,884 ms
73,460 KB
testcase_17 TLE -
testcase_18 AC 1,649 ms
68,008 KB
testcase_19 TLE -
testcase_20 AC 1,410 ms
65,864 KB
testcase_21 AC 1,783 ms
71,976 KB
testcase_22 TLE -
testcase_23 AC 958 ms
56,388 KB
testcase_24 AC 874 ms
56,388 KB
testcase_25 AC 1,277 ms
63,152 KB
testcase_26 AC 1,627 ms
78,152 KB
testcase_27 AC 1,682 ms
77,548 KB
testcase_28 TLE -
testcase_29 AC 1,014 ms
58,552 KB
testcase_30 TLE -
testcase_31 AC 1,865 ms
85,700 KB
testcase_32 AC 1,469 ms
73,844 KB
testcase_33 TLE -
testcase_34 AC 1,455 ms
68,900 KB
testcase_35 TLE -
testcase_36 AC 813 ms
56,660 KB
testcase_37 AC 820 ms
56,776 KB
testcase_38 AC 804 ms
56,388 KB
testcase_39 AC 826 ms
56,524 KB
testcase_40 AC 799 ms
56,524 KB
testcase_41 TLE -
testcase_42 AC 1,380 ms
73,544 KB
testcase_43 AC 1,827 ms
89,944 KB
testcase_44 AC 1,154 ms
66,380 KB
testcase_45 AC 1,780 ms
89,448 KB
testcase_46 AC 798 ms
56,404 KB
testcase_47 AC 805 ms
56,264 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

from scipy.sparse.csgraph import dijkstra
from scipy.sparse import csr_matrix

int1 = lambda x: int(x) - 1
N, M = map(int, input().split())
X, Y = map(int1, input().split())

P = [tuple(map(int, input().split())) for _ in range(N)]
length, frm, to = [], [], []
for _ in range(M):
    p, q = map(int1, input().split())
    length.append(((P[p][0] - P[q][0]) ** 2 + (P[p][1] - P[q][1]) ** 2) ** .5)
    frm.append(p)
    to.append(q)

matr = csr_matrix((length, (frm, to)), shape=(N, N))
print(dijkstra(matr, indices=X, directed=False)[Y])
0