# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
543986 | 2022-03-31T18:23:18 Z | brunnorezendes | Distributing Candies (IOI21_candies) | C++17 | 0 ms | 0 KB |
#include "parks.h" #include <bits/stdc++.h> using namespace std; typedef vector<int> vi; vi distribute_candies(vi c, vi l, vi r, vi v){ int i, j; int q = l.size(); int n = c.size(); vi val(n, 0); for(i=0;i<n;i++){ for(j=0;j<q;j++){ if(i>=l[j] && i<=r[j]){ if(v[j]<0) val[i] = max(0, val[i]+v[j]); else val[i] = min(c[i], val[i]+v[j]); } } } return val; }