結果
| 問題 | No.1065 電柱 / Pole (Easy) |
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2020-05-29 23:27:56 |
| 言語 | Python3 (3.13.1 + numpy 2.2.1 + scipy 1.14.1) |
| 結果 |
TLE
(最新)
AC
(最初)
|
| 実行時間 | - |
| コード長 | 682 bytes |
| 記録 | |
| コンパイル時間 | 474 ms |
| コンパイル使用メモリ | 12,672 KB |
| 実行使用メモリ | 121,816 KB |
| 最終ジャッジ日時 | 2024-11-06 08:18:41 |
| 合計ジャッジ時間 | 73,185 ms |
|
ジャッジサーバーID (参考情報) |
judge2 / judge4 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 2 |
| other | AC * 44 TLE * 2 |
ソースコード
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()