QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#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;
}
Details
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 | ^~~~~~~~~~~~