結果
| 問題 | No.1065 電柱 / Pole (Easy) |
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2020-05-29 23:27:56 |
| 言語 | Python3 (3.14.3 + numpy 2.4.4 + scipy 1.17.1) |
| 結果 |
TLE
(最新)
AC
(最初)
|
| 実行時間 | - |
| コード長 | 682 bytes |
| 記録 | |
| コンパイル時間 | 607 ms |
| コンパイル使用メモリ | 20,828 KB |
| 実行使用メモリ | 128,084 KB |
| 最終ジャッジ日時 | 2026-05-06 10:58:02 |
| 合計ジャッジ時間 | 14,064 ms |
|
ジャッジサーバーID (参考情報) |
judge1_1 / judge3_0 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 2 |
| other | AC * 42 TLE * 4 |
ソースコード
from scipy.sparse.csgraph import dijkstra
from scipy.sparse import csr_matrix
import sys
input = sys.stdin.readline
int1 = lambda x: int(x) - 1
def main():
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])
if __name__ == '__main__':
main()