結果

問題 No.1360 [Zelkova 4th Tune] 協和音
ユーザー yuruhiyayuruhiya
提出日時 2021-01-23 15:40:27
言語 Ruby
(3.3.0)
結果
TLE  
実行時間 -
コード長 274 bytes
コンパイル時間 452 ms
コンパイル使用メモリ 11,344 KB
実行使用メモリ 22,232 KB
最終ジャッジ日時 2023-08-29 05:52:22
合計ジャッジ時間 10,458 ms
ジャッジサーバーID
(参考情報)
judge12 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 85 ms
22,232 KB
testcase_01 AC 82 ms
15,232 KB
testcase_02 AC 86 ms
15,076 KB
testcase_03 AC 83 ms
15,192 KB
testcase_04 AC 82 ms
15,084 KB
testcase_05 AC 85 ms
15,312 KB
testcase_06 AC 82 ms
15,264 KB
testcase_07 AC 82 ms
15,176 KB
testcase_08 AC 84 ms
15,012 KB
testcase_09 AC 83 ms
15,180 KB
testcase_10 AC 82 ms
15,088 KB
testcase_11 AC 82 ms
15,188 KB
testcase_12 AC 81 ms
15,116 KB
testcase_13 AC 83 ms
15,060 KB
testcase_14 AC 85 ms
15,188 KB
testcase_15 AC 84 ms
15,256 KB
testcase_16 AC 84 ms
15,224 KB
testcase_17 AC 83 ms
15,276 KB
testcase_18 AC 84 ms
15,040 KB
testcase_19 AC 87 ms
15,280 KB
testcase_20 AC 84 ms
15,128 KB
testcase_21 AC 84 ms
15,132 KB
testcase_22 AC 88 ms
15,152 KB
testcase_23 AC 378 ms
15,144 KB
testcase_24 AC 723 ms
15,280 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) }
f = ->(i) { (0...n).select { i[_1] == 1 } }
g = ->(i) { x = f[i]; x.sum { a[_1] } + x.combination(2).sum { b[_1][_2] } }
ans = (1...1 << n).max_by(&g)
puts g[ans], f[ans].map{ _1 + 1 } * ' '
0