結果

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

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 91 ms
12,288 KB
testcase_01 AC 89 ms
12,288 KB
testcase_02 AC 108 ms
12,544 KB
testcase_03 AC 478 ms
12,544 KB
testcase_04 AC 127 ms
12,544 KB
testcase_05 AC 323 ms
12,416 KB
testcase_06 AC 228 ms
12,416 KB
testcase_07 AC 187 ms
12,288 KB
testcase_08 AC 489 ms
12,416 KB
testcase_09 AC 488 ms
12,416 KB
testcase_10 AC 417 ms
12,544 KB
testcase_11 AC 484 ms
12,544 KB
testcase_12 AC 91 ms
12,288 KB
testcase_13 AC 92 ms
12,160 KB
testcase_14 AC 91 ms
12,288 KB
testcase_15 AC 90 ms
12,160 KB
testcase_16 AC 91 ms
12,288 KB
testcase_17 AC 138 ms
12,416 KB
testcase_18 AC 396 ms
12,416 KB
testcase_19 AC 361 ms
12,416 KB
testcase_20 AC 127 ms
12,416 KB
testcase_21 AC 106 ms
12,288 KB
testcase_22 AC 440 ms
12,544 KB
testcase_23 AC 309 ms
12,416 KB
testcase_24 AC 380 ms
12,416 KB
testcase_25 AC 104 ms
12,416 KB
testcase_26 AC 442 ms
12,544 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]=E[$.-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