結果

問題 No.1360 [Zelkova 4th Tune] 協和音
ユーザー yuruhiyayuruhiya
提出日時 2021-01-23 15:29:08
言語 Crystal
(1.11.2)
結果
RE  
実行時間 -
コード長 422 bytes
コンパイル時間 17,966 ms
コンパイル使用メモリ 257,524 KB
実行使用メモリ 5,164 KB
最終ジャッジ日時 2023-09-13 13:14:08
合計ジャッジ時間 27,208 ms
ジャッジサーバーID
(参考情報)
judge13 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
4,432 KB
testcase_01 AC 2 ms
4,376 KB
testcase_02 AC 3 ms
4,376 KB
testcase_03 AC 2 ms
4,376 KB
testcase_04 AC 3 ms
4,384 KB
testcase_05 AC 2 ms
4,380 KB
testcase_06 AC 3 ms
4,444 KB
testcase_07 AC 2 ms
4,380 KB
testcase_08 AC 3 ms
4,388 KB
testcase_09 AC 2 ms
4,384 KB
testcase_10 AC 2 ms
4,380 KB
testcase_11 AC 3 ms
4,432 KB
testcase_12 AC 3 ms
4,396 KB
testcase_13 AC 2 ms
4,400 KB
testcase_14 AC 3 ms
4,652 KB
testcase_15 AC 3 ms
4,624 KB
testcase_16 AC 3 ms
4,440 KB
testcase_17 AC 3 ms
4,492 KB
testcase_18 AC 2 ms
4,420 KB
testcase_19 AC 4 ms
4,904 KB
testcase_20 AC 3 ms
4,612 KB
testcase_21 AC 2 ms
4,440 KB
testcase_22 AC 3 ms
4,856 KB
testcase_23 AC 69 ms
4,792 KB
testcase_24 AC 144 ms
5,044 KB
testcase_25 AC 684 ms
5,112 KB
testcase_26 AC 9 ms
4,716 KB
testcase_27 AC 6 ms
4,840 KB
testcase_28 AC 686 ms
5,048 KB
testcase_29 AC 33 ms
5,108 KB
testcase_30 AC 67 ms
5,064 KB
testcase_31 AC 68 ms
4,784 KB
testcase_32 AC 16 ms
4,772 KB
testcase_33 RE -
testcase_34 RE -
testcase_35 RE -
testcase_36 RE -
testcase_37 RE -
testcase_38 RE -
testcase_39 RE -
testcase_40 RE -
testcase_41 RE -
testcase_42 RE -
testcase_43 AC 3 ms
4,380 KB
testcase_44 AC 684 ms
5,164 KB
testcase_45 AC 2 ms
4,476 KB
testcase_46 AC 691 ms
5,004 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

lib C
  fun strtoll(s : UInt8*, p : UInt8**, b : Int32) : Int64
end

class String
  def to_i64
    C.strtoll(self, nil, 10)
  end
end

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