結果

問題 No.17 2つの地点に泊まりたい
ユーザー letrangerjpletrangerjp
提出日時 2017-06-04 20:59:59
言語 Ruby
(3.3.0)
結果
WA  
実行時間 -
コード長 236 bytes
コンパイル時間 176 ms
コンパイル使用メモリ 11,948 KB
実行使用メモリ 16,456 KB
最終ジャッジ日時 2023-10-22 04:24:36
合計ジャッジ時間 9,465 ms
ジャッジサーバーID
(参考情報)
judge10 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 87 ms
16,040 KB
testcase_01 AC 83 ms
16,040 KB
testcase_02 AC 101 ms
16,156 KB
testcase_03 AC 568 ms
16,364 KB
testcase_04 AC 127 ms
16,160 KB
testcase_05 AC 366 ms
16,292 KB
testcase_06 AC 249 ms
16,284 KB
testcase_07 AC 200 ms
16,184 KB
testcase_08 AC 561 ms
16,364 KB
testcase_09 AC 568 ms
16,364 KB
testcase_10 WA -
testcase_11 WA -
testcase_12 WA -
testcase_13 AC 84 ms
16,040 KB
testcase_14 WA -
testcase_15 WA -
testcase_16 WA -
testcase_17 WA -
testcase_18 WA -
testcase_19 AC 415 ms
16,296 KB
testcase_20 WA -
testcase_21 WA -
testcase_22 WA -
testcase_23 WA -
testcase_24 WA -
testcase_25 WA -
testcase_26 WA -
権限があれば一括ダウンロードができます
コンパイルメッセージ
Syntax OK

ソースコード

diff #

E=Hash.new 9e9
$<.map{|s|M||=s.to_i-1;*f,c=s.split.map &:to_i;E[f[0]?f:$.-2]=c}
(T=*0..M).product(T,T){|k,i,j|E[[j,i]]=E[x=[i,j]]=[E[x],E[[k,i]]+E[[k,j]]].min}
p [*1...M].permutation(2).map{|i,j|E[i]+E[j]+E[[0,i]]+E[[i,j]]+E[[j,M]]}.min
0