結果

問題 No.160 最短経路のうち辞書順最小
ユーザー 👑 hos.lyrichos.lyric
提出日時 2015-03-02 00:14:30
言語 Ruby
(3.2.2)
結果
AC  
実行時間 1,828 ms / 5,000 ms
コード長 219 bytes
コンパイル時間 64 ms
コンパイル使用メモリ 11,448 KB
実行使用メモリ 90,560 KB
最終ジャッジ日時 2023-09-06 06:06:47
合計ジャッジ時間 8,891 ms
ジャッジサーバーID
(参考情報)
judge13 / judge14
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 82 ms
15,120 KB
testcase_01 AC 80 ms
15,292 KB
testcase_02 AC 82 ms
15,092 KB
testcase_03 AC 79 ms
15,352 KB
testcase_04 AC 276 ms
28,288 KB
testcase_05 AC 467 ms
32,452 KB
testcase_06 AC 659 ms
38,736 KB
testcase_07 AC 182 ms
22,440 KB
testcase_08 AC 195 ms
23,280 KB
testcase_09 AC 170 ms
21,368 KB
testcase_10 AC 208 ms
24,084 KB
testcase_11 AC 217 ms
24,560 KB
testcase_12 AC 188 ms
22,564 KB
testcase_13 AC 180 ms
22,152 KB
testcase_14 AC 189 ms
22,500 KB
testcase_15 AC 178 ms
21,792 KB
testcase_16 AC 179 ms
22,024 KB
testcase_17 AC 190 ms
22,688 KB
testcase_18 AC 186 ms
22,300 KB
testcase_19 AC 186 ms
22,584 KB
testcase_20 AC 189 ms
22,864 KB
testcase_21 AC 175 ms
21,616 KB
testcase_22 AC 186 ms
21,948 KB
testcase_23 AC 206 ms
23,288 KB
testcase_24 AC 221 ms
24,808 KB
testcase_25 AC 185 ms
22,040 KB
testcase_26 AC 178 ms
21,992 KB
testcase_27 AC 111 ms
17,140 KB
testcase_28 AC 1,828 ms
90,560 KB
testcase_29 AC 102 ms
16,452 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