結果

問題 No.17 2つの地点に泊まりたい
ユーザー letrangerjpletrangerjp
提出日時 2017-06-07 00:06:33
言語 Ruby
(3.2.2)
結果
AC  
実行時間 478 ms / 5,000 ms
コード長 224 bytes
コンパイル時間 59 ms
コンパイル使用メモリ 11,472 KB
実行使用メモリ 15,636 KB
最終ジャッジ日時 2023-08-05 03:53:37
合計ジャッジ時間 7,732 ms
ジャッジサーバーID
(参考情報)
judge14 / judge13
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 80 ms
15,268 KB
testcase_01 AC 82 ms
15,156 KB
testcase_02 AC 95 ms
15,484 KB
testcase_03 AC 478 ms
15,392 KB
testcase_04 AC 116 ms
15,372 KB
testcase_05 AC 312 ms
15,428 KB
testcase_06 AC 214 ms
15,276 KB
testcase_07 AC 173 ms
15,372 KB
testcase_08 AC 469 ms
15,376 KB
testcase_09 AC 467 ms
15,492 KB
testcase_10 AC 403 ms
15,508 KB
testcase_11 AC 471 ms
15,608 KB
testcase_12 AC 81 ms
15,304 KB
testcase_13 AC 81 ms
15,160 KB
testcase_14 AC 80 ms
15,048 KB
testcase_15 AC 80 ms
15,108 KB
testcase_16 AC 79 ms
15,108 KB
testcase_17 AC 124 ms
15,260 KB
testcase_18 AC 384 ms
15,632 KB
testcase_19 AC 349 ms
15,472 KB
testcase_20 AC 111 ms
15,224 KB
testcase_21 AC 93 ms
15,396 KB
testcase_22 AC 430 ms
15,468 KB
testcase_23 AC 297 ms
15,404 KB
testcase_24 AC 367 ms
15,320 KB
testcase_25 AC 91 ms
15,432 KB
testcase_26 AC 429 ms
15,636 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