結果
問題 | No.788 トラックの移動 |
ユーザー | maspy |
提出日時 | 2020-03-17 10:49:48 |
言語 | Python3 (3.12.2 + numpy 1.26.4 + scipy 1.12.0) |
結果 |
TLE
|
実行時間 | - |
コード長 | 682 bytes |
コンパイル時間 | 171 ms |
コンパイル使用メモリ | 12,672 KB |
実行使用メモリ | 243,716 KB |
最終ジャッジ日時 | 2024-05-07 13:51:14 |
合計ジャッジ時間 | 6,821 ms |
ジャッジサーバーID (参考情報) |
judge3 / judge1 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | TLE | - |
testcase_01 | AC | 855 ms
56,520 KB |
testcase_02 | AC | 850 ms
56,656 KB |
testcase_03 | AC | 841 ms
56,492 KB |
testcase_04 | AC | 1,124 ms
79,116 KB |
testcase_05 | TLE | - |
testcase_06 | TLE | - |
testcase_07 | AC | 880 ms
56,900 KB |
testcase_08 | WA | - |
testcase_09 | AC | 864 ms
56,520 KB |
testcase_10 | AC | 850 ms
56,772 KB |
testcase_11 | WA | - |
testcase_12 | WA | - |
testcase_13 | AC | 856 ms
57,044 KB |
testcase_14 | AC | 847 ms
56,912 KB |
testcase_15 | AC | 1,107 ms
149,576 KB |
testcase_16 | AC | 1,662 ms
243,716 KB |
ソースコード
#!/usr/bin/env python3.8 # %% import sys read = sys.stdin.buffer.read readline = sys.stdin.buffer.readline readlines = sys.stdin.buffer.readlines import numpy as np from scipy.sparse.csgraph import dijkstra from scipy.sparse import csr_matrix # %% N, M, L = map(int, readline().split()) T = np.array(readline().split(), np.int64) ABC = np.array(read().split(), np.int64) A = ABC[::3] B = ABC[1::3] C = ABC[2::3] # %% graph = csr_matrix((C, (A - 1, B - 1)), (N, N)) dist = dijkstra(graph, directed=False) # %% dist = (dist + .5).astype(np.int64) cost = (dist * T[None, :]).sum(axis=1) * 2 diff = dist[L - 1][None, :] - dist * (T > 0) cost = cost[:, None] + diff print(cost.min())