# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
807724 | 2023-08-04T23:22:13 Z | Mouad_ouj | Distributing Candies (IOI21_candies) | C++17 | 0 ms | 0 KB |
#include "candies" #include<bits/stdc++.h> using namespace std; vector<int> distribute_candies(vector<int> c, vector<int> l, vector<int> r, vector<int> v) { vector<int> a; a.resize(c.size()); for(int y=0;y<l.size();y++) { for(int x=l[y];x<r[y];x++) { if(v[y]>0) a[x]=min(a[x]+v[y],c[x]); else a[x]=max(a[x]+v[y],0); } } return a; }