結果
| 問題 | No.1065 電柱 / Pole (Easy) |
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2020-09-23 22:32:22 |
| 言語 | Python3 (3.13.1 + numpy 2.2.1 + scipy 1.14.1) |
| 結果 |
TLE
(最新)
AC
(最初)
|
| 実行時間 | - |
| コード長 | 647 bytes |
| 記録 | |
| コンパイル時間 | 160 ms |
| コンパイル使用メモリ | 12,416 KB |
| 実行使用メモリ | 90,940 KB |
| 最終ジャッジ日時 | 2024-06-28 04:38:47 |
| 合計ジャッジ時間 | 71,420 ms |
|
ジャッジサーバーID (参考情報) |
judge2 / judge1 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 2 |
| other | AC * 45 TLE * 1 |
ソースコード
import sys
import numpy as np
from scipy.linalg import norm
from scipy.sparse.csgraph import dijkstra
from scipy.sparse import csr_matrix
input = sys.stdin.buffer.readline
int1 = lambda x: int(x) - 1
def main():
N, M = map(int, input().split())
X, Y = map(int1, input().split())
pole = np.array([tuple(map(int, input().split())) for _ in range(N)])
wire = np.array([tuple(map(int1, input().split())) for _ in range(M)]).T
length = norm(pole[wire[0]] - pole[wire[1]], axis=1)
matr = csr_matrix((length, wire), shape=(N, N))
print(dijkstra(matr, indices=X, directed=False)[Y])
if __name__ == '__main__':
main()