結果

問題 No.1360 [Zelkova 4th Tune] 協和音
ユーザー universatouniversato
提出日時 2021-01-22 21:58:47
言語 Ruby
(3.3.0)
結果
TLE  
実行時間 -
コード長 492 bytes
コンパイル時間 350 ms
コンパイル使用メモリ 11,360 KB
実行使用メモリ 15,460 KB
最終ジャッジ日時 2023-08-27 18:56:17
合計ジャッジ時間 44,076 ms
ジャッジサーバーID
(参考情報)
judge12 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 85 ms
15,160 KB
testcase_01 AC 81 ms
15,152 KB
testcase_02 AC 80 ms
15,300 KB
testcase_03 AC 80 ms
15,324 KB
testcase_04 AC 78 ms
15,276 KB
testcase_05 AC 82 ms
15,324 KB
testcase_06 AC 79 ms
15,312 KB
testcase_07 AC 80 ms
15,100 KB
testcase_08 AC 79 ms
15,256 KB
testcase_09 AC 79 ms
15,276 KB
testcase_10 AC 79 ms
15,184 KB
testcase_11 AC 80 ms
15,308 KB
testcase_12 AC 80 ms
15,308 KB
testcase_13 AC 80 ms
15,048 KB
testcase_14 AC 82 ms
15,096 KB
testcase_15 AC 82 ms
15,184 KB
testcase_16 AC 83 ms
15,280 KB
testcase_17 AC 81 ms
15,272 KB
testcase_18 AC 81 ms
15,248 KB
testcase_19 AC 83 ms
15,348 KB
testcase_20 AC 81 ms
15,260 KB
testcase_21 AC 80 ms
15,092 KB
testcase_22 AC 85 ms
15,300 KB
testcase_23 AC 301 ms
15,224 KB
testcase_24 AC 559 ms
15,324 KB
testcase_25 TLE -
testcase_26 AC 105 ms
15,460 KB
testcase_27 AC 93 ms
15,300 KB
testcase_28 TLE -
testcase_29 AC 176 ms
15,268 KB
testcase_30 AC 300 ms
15,252 KB
testcase_31 AC 298 ms
15,392 KB
testcase_32 AC 126 ms
15,340 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 81 ms
15,152 KB
testcase_44 TLE -
testcase_45 WA -
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
(0..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