結果

問題 No.1473 おでぶなおばけさん
ユーザー a a
提出日時 2022-10-07 11:25:58
言語 Python3
(3.13.1 + numpy 2.2.1 + scipy 1.14.1)
結果
WA  
実行時間 -
コード長 502 bytes
コンパイル時間 315 ms
コンパイル使用メモリ 12,672 KB
実行使用メモリ 58,640 KB
最終ジャッジ日時 2024-06-11 19:13:15
合計ジャッジ時間 6,369 ms
ジャッジサーバーID
(参考情報)
judge1 / judge2
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample WA * 1 TLE * 1
other -- * 47
権限があれば一括ダウンロードができます

ソースコード

diff #

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),indices=0)
    if sp[n-1]<=0:
        print(str(dmax-l)+" "+str(sp[n-1]))
        break
0