This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#include "candies.h"
#include <bits/stdc++.h>
#define F first
#define S second
#define V vector
#define PB push_back
#define EB emplace_back
#define MP make_pair
#define SZ(v) int((v).size())
#define ALL(v) (v).begin(), (v).end()
using namespace std;
typedef long long ll;
typedef pair<int, int> pi;
typedef V<int> vi;
const int INF = 1e9 + 7, N = 2e5 + 7;
int c[N], n;
int a[N];
vi distribute_candies(vi _c, vi _l, vi _r, vi _v) {
n = SZ(_c);
for(int i = 0; i < n; i++)
c[i] = _c[i];
int q = SZ(_l);
for(int i = 0; i < q; i++) {
int l = _l[i], r = _r[i], v = _v[i];
for(int j = l; j <= r; j++) {
a[j] += v;
a[j] = max(a[j], 0);
a[j] = min(a[j], c[j]);
}
}
vi ans(n);
for(int i = 0; i < n; i++)
ans[i] = a[i];
return ans;
}
# | 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... |