結果

問題 No.17 2つの地点に泊まりたい
ユーザー letrangerjpletrangerjp
提出日時 2017-06-04 21:12:18
言語 Ruby
(3.3.0)
結果
AC  
実行時間 489 ms / 5,000 ms
コード長 239 bytes
コンパイル時間 78 ms
コンパイル使用メモリ 7,552 KB
実行使用メモリ 12,544 KB
最終ジャッジ日時 2024-04-23 02:19:36
合計ジャッジ時間 7,848 ms
ジャッジサーバーID
(参考情報)
judge5 / judge4
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 99 ms
12,160 KB
testcase_01 AC 91 ms
12,160 KB
testcase_02 AC 108 ms
12,416 KB
testcase_03 AC 480 ms
12,544 KB
testcase_04 AC 130 ms
12,416 KB
testcase_05 AC 326 ms
12,416 KB
testcase_06 AC 229 ms
12,416 KB
testcase_07 AC 186 ms
12,544 KB
testcase_08 AC 488 ms
12,416 KB
testcase_09 AC 489 ms
12,416 KB
testcase_10 AC 417 ms
12,416 KB
testcase_11 AC 483 ms
12,544 KB
testcase_12 AC 91 ms
12,288 KB
testcase_13 AC 92 ms
12,288 KB
testcase_14 AC 90 ms
12,288 KB
testcase_15 AC 91 ms
12,160 KB
testcase_16 AC 92 ms
12,160 KB
testcase_17 AC 136 ms
12,544 KB
testcase_18 AC 397 ms
12,544 KB
testcase_19 AC 367 ms
12,544 KB
testcase_20 AC 125 ms
12,416 KB
testcase_21 AC 106 ms
12,288 KB
testcase_22 AC 439 ms
12,544 KB
testcase_23 AC 311 ms
12,416 KB
testcase_24 AC 382 ms
12,544 KB
testcase_25 AC 104 ms
12,416 KB
testcase_26 AC 445 ms
12,416 KB
権限があれば一括ダウンロードができます
コンパイルメッセージ
Syntax OK

ソースコード

diff #

E=Hash.new 9e9
$<.map{|s|M||=s.to_i-1;*f,c=s.split.map &:to_i;E[f.rotate]=E[f[0]?f:$.-2]=c}
(T=*0..M).product(T,T){|k,i,j|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