結果

問題 No.1473 おでぶなおばけさん
コンテスト
ユーザー a a
提出日時 2022-10-07 11:23:32
言語 Python3
(3.14.3 + numpy 2.4.4 + scipy 1.17.1)
コンパイル:
python3 -mpy_compile _filename_
実行:
python3 _filename_
結果
TLE  
実行時間 -
コード長 534 bytes
記録
記録タグの例:
初AC ショートコード 純ショートコード 純主流ショートコード 最速実行時間
コンパイル時間 328 ms
コンパイル使用メモリ 20,828 KB
実行使用メモリ 1,554,776 KB
最終ジャッジ日時 2026-03-05 01:09:44
合計ジャッジ時間 3,316 ms
ジャッジサーバーID
(参考情報)
judge3 / judge2
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample TLE * 2
other TLE * 20 MLE * 27
権限があれば一括ダウンロードができます

ソースコード

diff #
raw source code

import numpy as np
from scipy.sparse.csgraph import dijkstra
from scipy.sparse import csr_matrix
n,m=list(map(int,input().split()))
li=[[0 for i in range(n)] for j in range(n)]
dmax=0
for k in range (m):
    s,t,d=list(map(int,input().split()))
    li[s-1][t-1]=d
    li[t-1][s-1]=d
    dmax=max(dmax,d)
arl=np.array(li)
for l in range(dmax):
    a=np.where(arl>=(dmax-l),1,0)
    sp,=dijkstra(csgraph=csr_matrix(a),directed=False,indices=0,unweighted=True)
    if sp[n-1]<=0:
        print(str(dmax-l)+" "+str(sp[n-1]))
        break
0