結果

問題 No.1065 電柱 / Pole (Easy)
ユーザー H3PO4H3PO4
提出日時 2020-05-29 21:48:55
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
TLE  
(最新)
AC  
(最初)
実行時間 -
コード長 584 bytes
コンパイル時間 229 ms
コンパイル使用メモリ 12,672 KB
実行使用メモリ 122,620 KB
最終ジャッジ日時 2024-04-23 21:24:24
合計ジャッジ時間 66,769 ms
ジャッジサーバーID
(参考情報)
judge5 / judge3
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 818 ms
56,412 KB
testcase_01 AC 813 ms
56,532 KB
testcase_02 AC 1,396 ms
86,716 KB
testcase_03 AC 1,748 ms
107,664 KB
testcase_04 AC 1,761 ms
107,520 KB
testcase_05 AC 1,630 ms
100,144 KB
testcase_06 AC 1,586 ms
100,556 KB
testcase_07 AC 1,075 ms
71,128 KB
testcase_08 AC 1,776 ms
122,620 KB
testcase_09 AC 885 ms
58,968 KB
testcase_10 AC 1,257 ms
83,700 KB
testcase_11 AC 1,115 ms
73,812 KB
testcase_12 AC 1,110 ms
64,572 KB
testcase_13 AC 1,528 ms
85,444 KB
testcase_14 AC 1,604 ms
91,112 KB
testcase_15 AC 1,715 ms
97,152 KB
testcase_16 AC 1,307 ms
73,816 KB
testcase_17 AC 1,863 ms
101,500 KB
testcase_18 AC 1,169 ms
67,948 KB
testcase_19 AC 1,753 ms
100,596 KB
testcase_20 AC 1,091 ms
66,136 KB
testcase_21 AC 1,281 ms
71,688 KB
testcase_22 AC 1,677 ms
94,956 KB
testcase_23 AC 831 ms
56,664 KB
testcase_24 AC 835 ms
56,668 KB
testcase_25 AC 1,075 ms
63,260 KB
testcase_26 AC 1,353 ms
78,716 KB
testcase_27 AC 1,400 ms
78,024 KB
testcase_28 AC 1,750 ms
94,312 KB
testcase_29 AC 953 ms
58,324 KB
testcase_30 AC 1,721 ms
98,476 KB
testcase_31 AC 1,454 ms
85,764 KB
testcase_32 AC 1,238 ms
74,360 KB
testcase_33 AC 1,687 ms
96,240 KB
testcase_34 AC 1,180 ms
69,380 KB
testcase_35 AC 1,776 ms
99,220 KB
testcase_36 AC 820 ms
56,664 KB
testcase_37 AC 823 ms
56,788 KB
testcase_38 AC 810 ms
56,792 KB
testcase_39 AC 827 ms
57,176 KB
testcase_40 AC 803 ms
56,664 KB
testcase_41 TLE -
testcase_42 AC 1,179 ms
73,820 KB
testcase_43 AC 1,447 ms
89,828 KB
testcase_44 AC 1,014 ms
66,408 KB
testcase_45 AC 1,407 ms
88,972 KB
testcase_46 AC 807 ms
56,544 KB
testcase_47 AC 811 ms
56,280 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

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

input = sys.stdin.readline

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 = [.0] * M, [0] * M, [0] * M
for i in range(M):
    p, q = map(int1, input().split())
    length[i] = ((P[p][0] - P[q][0]) ** 2 + (P[p][1] - P[q][1]) ** 2) ** .5
    frm[i] = p
    to[i] = q

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