結果

問題 No.1360 [Zelkova 4th Tune] 協和音
ユーザー universatouniversato
提出日時 2021-01-22 22:02:12
言語 Ruby
(3.2.2)
結果
TLE  
(最新)
AC  
(最初)
実行時間 -
コード長 493 bytes
コンパイル時間 511 ms
コンパイル使用メモリ 11,452 KB
実行使用メモリ 15,524 KB
最終ジャッジ日時 2023-08-27 19:11:26
合計ジャッジ時間 43,058 ms
ジャッジサーバーID
(参考情報)
judge15 / judge14
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 79 ms
15,328 KB
testcase_01 AC 79 ms
15,192 KB
testcase_02 AC 78 ms
15,200 KB
testcase_03 AC 81 ms
15,048 KB
testcase_04 AC 77 ms
15,168 KB
testcase_05 AC 77 ms
15,176 KB
testcase_06 AC 76 ms
15,196 KB
testcase_07 AC 78 ms
15,344 KB
testcase_08 AC 79 ms
15,340 KB
testcase_09 AC 78 ms
15,260 KB
testcase_10 AC 77 ms
15,092 KB
testcase_11 AC 79 ms
15,292 KB
testcase_12 AC 79 ms
15,144 KB
testcase_13 AC 77 ms
15,292 KB
testcase_14 AC 79 ms
15,160 KB
testcase_15 AC 80 ms
15,160 KB
testcase_16 AC 79 ms
15,124 KB
testcase_17 AC 79 ms
15,096 KB
testcase_18 AC 77 ms
15,296 KB
testcase_19 AC 79 ms
15,124 KB
testcase_20 AC 79 ms
15,056 KB
testcase_21 AC 77 ms
15,096 KB
testcase_22 AC 80 ms
15,176 KB
testcase_23 AC 297 ms
15,164 KB
testcase_24 AC 559 ms
15,256 KB
testcase_25 TLE -
testcase_26 AC 99 ms
15,184 KB
testcase_27 AC 87 ms
15,392 KB
testcase_28 TLE -
testcase_29 AC 175 ms
15,260 KB
testcase_30 AC 294 ms
15,088 KB
testcase_31 AC 293 ms
15,432 KB
testcase_32 AC 122 ms
15,376 KB
testcase_33 TLE -
testcase_34 TLE -
testcase_35 TLE -
testcase_36 TLE -
testcase_37 TLE -
testcase_38 TLE -
testcase_39 TLE -
testcase_40 TLE -
testcase_41 TLE -
testcase_42 TLE -
testcase_43 AC 85 ms
15,288 KB
testcase_44 TLE -
testcase_45 AC 76 ms
15,244 KB
testcase_46 TLE -
権限があれば一括ダウンロードができます
コンパイルメッセージ
Syntax OK

ソースコード

diff #

n = gets.to_s.to_i
a = gets.to_s.split.map{ |e| e.to_i }
b = readlines.map{ |s| s.split.map{ |e| e.to_i } }

# p (0..18).sum{ |k| ([*0...18]).combination(k).size }

ans = -Float::INFINITY
ans_cmb = nil
ia = (0...n).to_a
(1..n).each do |i|
  ia.combination(i) do |cmb|
    tmp = cmb.sum{ |j| a[j] }
    tmp += cmb.combination(2).sum{ |x, y| b[x][y] }
    tmp_cmb = cmb
    if ans < tmp
      ans = tmp
      ans_cmb = tmp_cmb
    end
  end
end

puts ans
puts ans_cmb.map{ |k| k + 1 }.join(' ')
0