結果

問題 No.160 最短経路のうち辞書順最小
ユーザー 👑 hos.lyrichos.lyric
提出日時 2015-03-02 00:14:08
言語 Ruby
(3.3.0)
結果
AC  
実行時間 1,988 ms / 5,000 ms
コード長 220 bytes
コンパイル時間 60 ms
コンパイル使用メモリ 11,452 KB
実行使用メモリ 90,520 KB
最終ジャッジ日時 2023-08-26 23:13:57
合計ジャッジ時間 10,181 ms
ジャッジサーバーID
(参考情報)
judge15 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 84 ms
15,136 KB
testcase_01 AC 89 ms
15,128 KB
testcase_02 AC 88 ms
15,252 KB
testcase_03 AC 84 ms
15,152 KB
testcase_04 AC 286 ms
28,236 KB
testcase_05 AC 489 ms
32,304 KB
testcase_06 AC 693 ms
38,880 KB
testcase_07 AC 192 ms
22,568 KB
testcase_08 AC 207 ms
23,392 KB
testcase_09 AC 179 ms
21,504 KB
testcase_10 AC 216 ms
24,068 KB
testcase_11 AC 224 ms
24,636 KB
testcase_12 AC 199 ms
22,576 KB
testcase_13 AC 187 ms
22,148 KB
testcase_14 AC 193 ms
22,400 KB
testcase_15 AC 184 ms
21,992 KB
testcase_16 AC 187 ms
21,984 KB
testcase_17 AC 201 ms
22,564 KB
testcase_18 AC 197 ms
22,032 KB
testcase_19 AC 197 ms
22,380 KB
testcase_20 AC 195 ms
22,804 KB
testcase_21 AC 181 ms
21,780 KB
testcase_22 AC 183 ms
21,876 KB
testcase_23 AC 208 ms
23,352 KB
testcase_24 AC 230 ms
24,548 KB
testcase_25 AC 188 ms
22,308 KB
testcase_26 AC 184 ms
21,768 KB
testcase_27 AC 114 ms
17,000 KB
testcase_28 AC 1,988 ms
90,520 KB
testcase_29 AC 106 ms
16,492 KB
権限があれば一括ダウンロードができます
コンパイルメッセージ
Syntax OK

ソースコード

diff #

n,m,s,t=gets.split.map &:to_i
o=[]
m.times{a,b,c=gets.split.map &:to_i;o<<[a,b,c]<<[b,a,c]}
d=[1e9]*n
d[t]=0
n.times{o.map{|a,b,c|x=c+d[b];d[a]>x&&d[a]=x}}
(print s,' ';s=o.map{|a,b,c|s!=a||d[a]<c+d[b]?n:b}.min)while s<n
0