QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#449655 | #8598. AND Масив | Qwerty1232# | Compile Error | / | / | C++23 | 909b | 2024-06-21 15:40:28 | 2024-06-21 15:40:31 |
Judging History
answer
#pragma GCC optimize("O3")
#pragma GCC target("avx2")
#include <bits/stdc++.h>
constexpr int B = 20;
int dp[2][1 << B + 1];
int32_t main() {
std::ios_base::sync_with_stdio(false);
std::cin.tie(nullptr);
int n, b;
std::cin >> n >> b;
std::vector<int> input(n);
for (int i = 0; i < n; i++) {
std::cin >> input[i];
}
std::vector<int> ans(n);
for (int i = n - 1; i >= 0; i--) {
auto& dp1 = dp[i % 2];
auto& dp2 = dp[i % 2 ^ 1];
int val = input[i];
for (int j = 0; j < (1 << b); j++) {
dp2[j] = (j & val) ? dp1[j] : dp1[j + val] + (i + 1);
assert(dp2[j] <= 1e9);
}
for (int j = 0; j < b; j++) {
ans[i] += dp2[1 << j];
}
}
for (int i = 0; i < n; i++) {
std::cout << ans[i] << " \n"[i == n - 1];
}
return 0;
}
Details
In file included from /usr/include/c++/13/string:43, from /usr/include/c++/13/bitset:52, from /usr/include/x86_64-linux-gnu/c++/13/bits/stdc++.h:52, from answer.code:3: /usr/include/c++/13/bits/allocator.h: In destructor ‘constexpr std::_Vector_base<int, std::allocator<int> >::_Vector_impl::~_Vector_impl()’: /usr/include/c++/13/bits/allocator.h:184:7: error: inlining failed in call to ‘always_inline’ ‘constexpr std::allocator< <template-parameter-1-1> >::~allocator() noexcept [with _Tp = int]’: target specific option mismatch 184 | ~allocator() _GLIBCXX_NOTHROW { } | ^ In file included from /usr/include/c++/13/vector:66, from /usr/include/c++/13/functional:64, from /usr/include/x86_64-linux-gnu/c++/13/bits/stdc++.h:53: /usr/include/c++/13/bits/stl_vector.h:133:14: note: called from here 133 | struct _Vector_impl | ^~~~~~~~~~~~