# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
788512 | 2023-07-20T10:05:28 Z | alexander707070 | Distributing Candies (IOI21_candies) | C++17 | 0 ms | 0 KB |
#include<bits/stdc++.h> #define MAXN 1000007 using namespace std; int n; vector<int> curr; vector<int> distribute_candies(vector<int> c,vector<int> l,vector<int> r,vector<int> v){ n=int(c.size()); curr.resize(n); for(int i=0;i<q;i++){ for(int f=l[i];f<=r[i];f++){ curr[f]+=v[i]; if(curr[f]<0)curr[f]=0; if(curr[f]>c[f])curr[f]=c[f]; } } return curr; }