結果
問題 | No.1245 ANDORゲーム(calc) |
ユーザー | siman |
提出日時 | 2023-04-11 22:57:52 |
言語 | Ruby (3.3.0) |
結果 |
TLE
|
実行時間 | - |
コード長 | 536 bytes |
コンパイル時間 | 159 ms |
コンパイル使用メモリ | 7,552 KB |
実行使用メモリ | 38,052 KB |
最終ジャッジ日時 | 2024-04-16 18:30:41 |
合計ジャッジ時間 | 7,075 ms |
ジャッジサーバーID (参考情報) |
judge3 / judge2 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 91 ms
17,536 KB |
testcase_01 | AC | 89 ms
12,032 KB |
testcase_02 | AC | 89 ms
12,032 KB |
testcase_03 | AC | 87 ms
12,288 KB |
testcase_04 | AC | 89 ms
12,032 KB |
testcase_05 | AC | 89 ms
12,288 KB |
testcase_06 | AC | 88 ms
12,160 KB |
testcase_07 | AC | 171 ms
12,544 KB |
testcase_08 | AC | 113 ms
12,288 KB |
testcase_09 | AC | 160 ms
12,544 KB |
testcase_10 | AC | 156 ms
12,544 KB |
testcase_11 | TLE | - |
testcase_12 | TLE | - |
testcase_13 | TLE | - |
testcase_14 | TLE | - |
testcase_15 | TLE | - |
testcase_16 | TLE | - |
testcase_17 | TLE | - |
testcase_18 | TLE | - |
testcase_19 | TLE | - |
testcase_20 | -- | - |
testcase_21 | -- | - |
testcase_22 | -- | - |
testcase_23 | -- | - |
testcase_24 | -- | - |
testcase_25 | -- | - |
testcase_26 | -- | - |
testcase_27 | -- | - |
コンパイルメッセージ
Syntax OK
ソースコード
N, Q = gets.split.map(&:to_i) A = gets.split.map(&:to_i) S = gets.chomp T = gets.split.map(&:to_i) len = A.map(&:bit_length).max memo = Array.new(len) { Array.new(2, 0) } len.times do |i| val = 2.pow(i) 2.times do |d| cur = d A.each.with_index do |a, idx| b_cur = cur if S[idx] == '0' cur &= a[i] else cur |= a[i] end memo[i][d] += (cur ^ b_cur) * val end end end T.each do |t| ans = 0 len.times do |i| d = t[i] ans += memo[i][d] end puts ans end