이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#pragma GCC optimize("Ofast")
#pragma GCC target("avx2")
#include "bits/extc++.h"
using namespace std;
template <typename T>
void dbgh(const T& t) {
cerr << t << endl;
}
template <typename T, typename... U>
void dbgh(const T& t, const U&... u) {
cerr << t << " | ";
dbgh(u...);
}
#ifdef DEBUG
#define dbg(...) \
cerr << "L" << __LINE__ << " [" << #__VA_ARGS__ << "]: "; \
dbgh(__VA_ARGS__);
#else
#define dbg(...)
#define cerr \
if (false) \
cerr
#endif
#define endl "\n"
#define long int64_t
#define sz(x) int((x).size())
vector<int> distribute_candies(vector<int> arr,
vector<int> ql,
vector<int> qr,
vector<int> qv) {
int n = sz(arr), q = sz(ql);
int ans[n] {};
for (int qi = 0; qi < q; qi++) {
int l = ql[qi], r = qr[qi], v = qv[qi];
if (v >= 0) {
for (int i = l; i <= r; i++) {
ans[i] += v;
}
#pragma GCC ivdep
for (int i = l; i <= r; i++) {
ans[i] = min(ans[i], arr[i]);
}
} else {
for (int i = l; i <= r; i++) {
ans[i] = max(0, ans[i] + v);
}
}
}
return vector<int>(ans, ans + n);
}
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |