QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#449655#8598. AND МасивQwerty1232#Compile Error//C++23909b2024-06-21 15:40:282024-06-21 15:40:31

Judging History

你现在查看的是最新测评结果

  • [2024-06-21 15:40:31]
  • 评测
  • [2024-06-21 15:40:28]
  • 提交

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;
}

詳細信息

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
      |              ^~~~~~~~~~~~