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;
#include "candies.h"
vector<int> distribute_candies(vector<int> c, vector<int> l, vector<int> r, vector<int> v){
int N = c.size(), Q = v.size();
vector<int> ans(N, 0);
for(int i = 0; i < Q; i++){
for(int j = l[i]; j <= r[i]; j++){
if(v[i] < 0) ans[j] = max(0, ans[j] + v[i]);
else if(v[i] > 0) ans[j] = min(c[j], ans[j] + v[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... |