# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
546815 | Trisanu_Das | Distributing Candies (IOI21_candies) | C++17 | 0 ms | 0 KiB |
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 <bits/stdc++.h>
using namespace std;
vector<int> distribute_candies(int[] c, int[] l, int[] r, int[] v){
int n = c.size();
vector<int> a(n);
for(int i = 0; i < q; ++i) {
for(int j = l[i]; j <= l[i]; ++j) {
a[j] += v[i];
a[j] = max(a[j], 0); a[j] = min(a[j], c[j]);
}
}
return a;
}