結果

問題 No.1360 [Zelkova 4th Tune] 協和音
ユーザー yuruhiyayuruhiya
提出日時 2021-01-23 15:30:29
言語 Crystal
(1.11.2)
結果
AC  
実行時間 735 ms / 2,000 ms
コード長 291 bytes
コンパイル時間 22,365 ms
コンパイル使用メモリ 259,064 KB
実行使用メモリ 5,164 KB
最終ジャッジ日時 2023-09-13 13:13:01
合計ジャッジ時間 38,146 ms
ジャッジサーバーID
(参考情報)
judge12 / judge14
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
4,376 KB
testcase_01 AC 3 ms
4,376 KB
testcase_02 AC 3 ms
4,380 KB
testcase_03 AC 3 ms
4,376 KB
testcase_04 AC 2 ms
4,380 KB
testcase_05 AC 3 ms
4,396 KB
testcase_06 AC 3 ms
4,376 KB
testcase_07 AC 2 ms
4,376 KB
testcase_08 AC 3 ms
4,376 KB
testcase_09 AC 3 ms
4,380 KB
testcase_10 AC 2 ms
4,384 KB
testcase_11 AC 3 ms
4,380 KB
testcase_12 AC 3 ms
4,380 KB
testcase_13 AC 3 ms
4,380 KB
testcase_14 AC 3 ms
4,592 KB
testcase_15 AC 3 ms
4,548 KB
testcase_16 AC 3 ms
4,460 KB
testcase_17 AC 3 ms
4,540 KB
testcase_18 AC 2 ms
4,376 KB
testcase_19 AC 4 ms
4,744 KB
testcase_20 AC 3 ms
4,484 KB
testcase_21 AC 3 ms
4,376 KB
testcase_22 AC 3 ms
4,816 KB
testcase_23 AC 71 ms
5,120 KB
testcase_24 AC 151 ms
5,164 KB
testcase_25 AC 725 ms
5,124 KB
testcase_26 AC 9 ms
4,844 KB
testcase_27 AC 6 ms
4,768 KB
testcase_28 AC 718 ms
5,124 KB
testcase_29 AC 35 ms
4,776 KB
testcase_30 AC 72 ms
5,132 KB
testcase_31 AC 71 ms
5,080 KB
testcase_32 AC 17 ms
4,840 KB
testcase_33 AC 721 ms
4,976 KB
testcase_34 AC 725 ms
5,112 KB
testcase_35 AC 727 ms
5,080 KB
testcase_36 AC 731 ms
5,036 KB
testcase_37 AC 726 ms
5,104 KB
testcase_38 AC 723 ms
5,092 KB
testcase_39 AC 722 ms
5,024 KB
testcase_40 AC 723 ms
5,084 KB
testcase_41 AC 735 ms
5,064 KB
testcase_42 AC 723 ms
5,124 KB
testcase_43 AC 2 ms
4,468 KB
testcase_44 AC 729 ms
5,032 KB
testcase_45 AC 3 ms
4,380 KB
testcase_46 AC 729 ms
5,036 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

n = read_line.to_i
a = read_line.split.map(&.to_i64)
b = (1..n).map { read_line.split.map(&.to_i64) }
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