QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#140629#1140. Distributing CandiesQwerty1232#Compile Error//C++20717b2023-08-16 14:56:302024-07-04 02:37:54

Judging History

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

  • [2024-07-04 02:37:54]
  • 评测
  • [2023-08-16 14:56:30]
  • 提交

answer

#pragma GCC optimize("O3")
#pragma GCC target("avx512f,avx512vl,avx512dq,avx512bw")
#include "candies.h"

#include <vector>

std::vector<int> distribute_candies(std::vector<int> c, std::vector<int> L, std::vector<int> R, std::vector<int> V) {
    int n = c.size();
    int q = L.size();

    std::vector<int> s(n);
    for (int i = 0; i < q; i++) {
        int l = L[i], r = R[i], dlt = V[i];
        r++;
        if (dlt < 0) {
            for (int j = l; j < r; j++) {
                s[j] = std::max(0, s[j] + dlt);
            }
        } else {
            for (int j = l; j < r; j++) {
                s[j] = std::min(c[j], s[j] + dlt);
            }
        }
    }

    return s;
}

详细

In file included from /usr/include/c++/13/vector:63,
                 from candies.h:1,
                 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:
/usr/include/c++/13/bits/stl_vector.h:133:14: note: called from here
  133 |       struct _Vector_impl
      |              ^~~~~~~~~~~~