#include "candies.h"
#include <bits/stdc++.h>
using namespace std;
vector<int> distribute_candies(vector<int> c,vector<int> l, vector<int> r, vector<int> v) {
int n = c.size();
vector<int> s(n);
for(int i=0;i<n;i++) {
s[i]=0;
}
int q=v.size();
for(int i=0;i<q;i++) {
for(int j=l[i];j<=r[i];j++) {
s[j]+=v[i];
s[j]=max(0,s[j]);
s[j]=min(c[j],s[j]);
}
}
return s;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
204 KB |
Output is correct |
2 |
Correct |
0 ms |
204 KB |
Output is correct |
3 |
Correct |
1 ms |
332 KB |
Output is correct |
4 |
Correct |
1 ms |
332 KB |
Output is correct |
5 |
Correct |
3 ms |
332 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Execution timed out |
5043 ms |
7216 KB |
Time limit exceeded |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
204 KB |
Output is correct |
2 |
Correct |
223 ms |
4960 KB |
Output is correct |
3 |
Correct |
200 ms |
3772 KB |
Output is correct |
4 |
Execution timed out |
5043 ms |
7236 KB |
Time limit exceeded |
5 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
204 KB |
Output is correct |
2 |
Correct |
1 ms |
204 KB |
Output is correct |
3 |
Correct |
504 ms |
5024 KB |
Output is correct |
4 |
Correct |
495 ms |
2796 KB |
Output is correct |
5 |
Execution timed out |
5034 ms |
7348 KB |
Time limit exceeded |
6 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
204 KB |
Output is correct |
2 |
Correct |
0 ms |
204 KB |
Output is correct |
3 |
Correct |
1 ms |
332 KB |
Output is correct |
4 |
Correct |
1 ms |
332 KB |
Output is correct |
5 |
Correct |
3 ms |
332 KB |
Output is correct |
6 |
Execution timed out |
5043 ms |
7216 KB |
Time limit exceeded |
7 |
Halted |
0 ms |
0 KB |
- |