結果

問題 No.1360 [Zelkova 4th Tune] 協和音
ユーザー yuruhiyayuruhiya
提出日時 2021-01-23 15:43:37
言語 Crystal
(1.11.2)
結果
AC  
実行時間 1,758 ms / 2,000 ms
コード長 309 bytes
コンパイル時間 20,052 ms
コンパイル使用メモリ 262,436 KB
実行使用メモリ 5,628 KB
最終ジャッジ日時 2023-09-13 13:15:03
合計ジャッジ時間 48,377 ms
ジャッジサーバーID
(参考情報)
judge14 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
4,840 KB
testcase_01 AC 3 ms
4,824 KB
testcase_02 AC 2 ms
4,792 KB
testcase_03 AC 3 ms
4,840 KB
testcase_04 AC 3 ms
4,720 KB
testcase_05 AC 3 ms
4,804 KB
testcase_06 AC 3 ms
4,888 KB
testcase_07 AC 3 ms
4,876 KB
testcase_08 AC 3 ms
4,824 KB
testcase_09 AC 3 ms
4,820 KB
testcase_10 AC 3 ms
4,696 KB
testcase_11 AC 3 ms
4,792 KB
testcase_12 AC 3 ms
4,936 KB
testcase_13 AC 3 ms
4,784 KB
testcase_14 AC 3 ms
5,104 KB
testcase_15 AC 4 ms
5,060 KB
testcase_16 AC 3 ms
4,956 KB
testcase_17 AC 4 ms
5,044 KB
testcase_18 AC 3 ms
4,852 KB
testcase_19 AC 4 ms
5,252 KB
testcase_20 AC 4 ms
5,176 KB
testcase_21 AC 3 ms
4,896 KB
testcase_22 AC 4 ms
5,228 KB
testcase_23 AC 154 ms
5,532 KB
testcase_24 AC 340 ms
5,536 KB
testcase_25 AC 1,688 ms
5,536 KB
testcase_26 AC 17 ms
5,472 KB
testcase_27 AC 9 ms
5,560 KB
testcase_28 AC 1,693 ms
5,548 KB
testcase_29 AC 71 ms
5,604 KB
testcase_30 AC 154 ms
5,540 KB
testcase_31 AC 156 ms
5,488 KB
testcase_32 AC 34 ms
5,396 KB
testcase_33 AC 1,704 ms
5,536 KB
testcase_34 AC 1,707 ms
5,628 KB
testcase_35 AC 1,702 ms
5,596 KB
testcase_36 AC 1,712 ms
5,408 KB
testcase_37 AC 1,694 ms
5,620 KB
testcase_38 AC 1,758 ms
5,532 KB
testcase_39 AC 1,699 ms
5,592 KB
testcase_40 AC 1,698 ms
5,476 KB
testcase_41 AC 1,701 ms
5,512 KB
testcase_42 AC 1,710 ms
5,620 KB
testcase_43 AC 3 ms
4,824 KB
testcase_44 AC 1,011 ms
5,488 KB
testcase_45 AC 3 ms
4,752 KB
testcase_46 AC 1,489 ms
5,476 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

require "big"
n = read_line.to_i
a = read_line.split.map(&.to_big_i)
b = (1..n).map { read_line.split.map(&.to_big_i) }
ans, bit = (1...1 << n).max_of { |bit|
  x = (0...n).select { |i| bit.bit(i) == 1 }
  {x.sum { |i| a[i] } + x.combinations(2).sum { |(i, j)| b[i][j] }, x}
}
puts ans, bit.join(' ', &.+(1))
0