# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
625311 | 2022-08-10T03:07:41 Z | il9 | Distributing Candies (IOI21_candies) | C++17 | 107 ms | 11520 KB |
#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> pre(c.size()+2); pre[0]=0; int n=c.size(); for(int i=0;i<r.size()-1;i++) { pre[l[i]+1]+=v[i]; pre[r[i]+2]-=v[i]; } for(int i=1;i<=n;i++) { pre[i]+=pre[i-1]; //cout<<pre[i]<<" "; } for(int i=0;i<n;i++) { if(pre[i+1]>c[i]) { pre[i+1]=c[i]; } } for(int i=l[r.size()-1];i<=r[r.size()-1];i++) { pre[i+1]=max(min(pre[i+1]+v[r.size()-1],c[i]),0); } for(int i=0;i<n;i++) { l[i]=pre[i+1]; //cout<<pre[i+1]<<" "; } //cout<<"\n"; return l; }
Compilation message
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 0 ms | 212 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 107 ms | 11520 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Runtime error | 1 ms | 468 KB | Execution killed with signal 6 |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 1 ms | 212 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 0 ms | 212 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |