QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#140629 | #1140. Distributing Candies | Qwerty1232# | Compile Error | / | / | C++20 | 717b | 2023-08-16 14:56:30 | 2024-07-04 02:37:54 |
Judging History
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;
}
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 ‘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 | ^~~~~~~~~~~~