QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#535433 | #1140. Distributing Candies | green_gold_dog | Compile Error | / | / | C++14 | 687b | 2024-08-28 01:36:59 | 2024-08-28 01:36:59 |
Judging History
answer
#pragma GCC optimize("O3")
#pragma GCC target("avx2")
#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 ‘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’ ‘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 | ^~~~~~~~~~~~