結果
| 問題 |
No.1065 電柱 / Pole (Easy)
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2020-05-29 21:42:52 |
| 言語 | Python3 (3.13.1 + numpy 2.2.1 + scipy 1.14.1) |
| 結果 |
TLE
(最新)
AC
(最初)
|
| 実行時間 | - |
| コード長 | 538 bytes |
| コンパイル時間 | 109 ms |
| コンパイル使用メモリ | 12,544 KB |
| 実行使用メモリ | 129,696 KB |
| 最終ジャッジ日時 | 2024-11-06 03:14:51 |
| 合計ジャッジ時間 | 24,591 ms |
|
ジャッジサーバーID (参考情報) |
judge1 / judge3 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 2 |
| other | AC * 6 TLE * 10 -- * 30 |
ソースコード
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])