結果

問題 No.1360 [Zelkova 4th Tune] 協和音
ユーザー yuruhiyayuruhiya
提出日時 2021-01-23 15:32:30
言語 Ruby
(3.3.0)
結果
TLE  
実行時間 -
コード長 274 bytes
コンパイル時間 97 ms
コンパイル使用メモリ 11,400 KB
実行使用メモリ 87,252 KB
最終ジャッジ日時 2023-08-29 04:58:14
合計ジャッジ時間 11,069 ms
ジャッジサーバーID
(参考情報)
judge13 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 82 ms
19,412 KB
testcase_01 AC 79 ms
15,284 KB
testcase_02 AC 80 ms
15,144 KB
testcase_03 AC 80 ms
15,280 KB
testcase_04 AC 82 ms
15,032 KB
testcase_05 AC 79 ms
15,076 KB
testcase_06 AC 79 ms
15,036 KB
testcase_07 AC 79 ms
15,084 KB
testcase_08 AC 78 ms
15,276 KB
testcase_09 AC 82 ms
15,040 KB
testcase_10 AC 81 ms
15,124 KB
testcase_11 AC 80 ms
14,996 KB
testcase_12 AC 80 ms
15,076 KB
testcase_13 AC 79 ms
15,096 KB
testcase_14 AC 81 ms
15,276 KB
testcase_15 AC 81 ms
15,240 KB
testcase_16 AC 82 ms
15,036 KB
testcase_17 AC 82 ms
15,248 KB
testcase_18 AC 79 ms
15,028 KB
testcase_19 AC 83 ms
15,004 KB
testcase_20 AC 83 ms
15,124 KB
testcase_21 AC 78 ms
15,252 KB
testcase_22 AC 85 ms
15,084 KB
testcase_23 AC 482 ms
26,972 KB
testcase_24 AC 1,009 ms
39,428 KB
testcase_25 TLE -
testcase_26 -- -
testcase_27 -- -
testcase_28 -- -
testcase_29 -- -
testcase_30 -- -
testcase_31 -- -
testcase_32 -- -
testcase_33 -- -
testcase_34 -- -
testcase_35 -- -
testcase_36 -- -
testcase_37 -- -
testcase_38 -- -
testcase_39 -- -
testcase_40 -- -
testcase_41 -- -
testcase_42 -- -
testcase_43 -- -
testcase_44 -- -
testcase_45 -- -
testcase_46 -- -
権限があれば一括ダウンロードができます
コンパイルメッセージ
Syntax OK

ソースコード

diff #

n = gets.to_i
a = gets.split.map(&:to_i)
b = (1..n).map { gets.split.map(&:to_i) }
ans, bit = (1...1 << n).map { |bit|
  x = (0...n).select { |i| bit[i] == 1 }
  [x.sum { |i| a[i] } + x.combination(2).sum { |(i, j)| b[i][j] }, x]
}.max
puts ans, bit.map{ _1 + 1 }.join(' ')
0