結果

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

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 84 ms
12,416 KB
testcase_01 AC 82 ms
12,160 KB
testcase_02 AC 86 ms
12,416 KB
testcase_03 AC 418 ms
12,544 KB
testcase_04 AC 108 ms
12,416 KB
testcase_05 AC 284 ms
12,544 KB
testcase_06 AC 192 ms
12,416 KB
testcase_07 AC 161 ms
12,672 KB
testcase_08 AC 424 ms
12,416 KB
testcase_09 AC 438 ms
12,672 KB
testcase_10 AC 356 ms
12,416 KB
testcase_11 AC 422 ms
12,416 KB
testcase_12 AC 74 ms
12,160 KB
testcase_13 AC 76 ms
12,416 KB
testcase_14 AC 78 ms
12,288 KB
testcase_15 AC 77 ms
12,160 KB
testcase_16 AC 76 ms
12,160 KB
testcase_17 AC 118 ms
12,544 KB
testcase_18 AC 347 ms
12,416 KB
testcase_19 AC 307 ms
12,416 KB
testcase_20 AC 99 ms
12,672 KB
testcase_21 AC 85 ms
12,544 KB
testcase_22 AC 384 ms
12,416 KB
testcase_23 AC 262 ms
12,544 KB
testcase_24 AC 332 ms
12,416 KB
testcase_25 AC 88 ms
12,416 KB
testcase_26 AC 387 ms
12,544 KB
権限があれば一括ダウンロードができます
コンパイルメッセージ
Syntax OK

ソースコード

diff #

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