#include <bits/stdc++.h>
#include "candies.h"
using namespace std;
const int mxN = 200005;
vector<int> distribute_candies(vector<int> c, vector<int> l, vector<int> r, vector<int> v) {
int n = int(c.size()), q = int(l.size());
vector<int> ans(n, 0);
for(int i = 0; i < q; i++) {
for(int j = l[i]; j <= r[i]; j++) {
if(v[i] > 0)
ans[j] = min(c[j], ans[j]+v[i]);
else
ans[j] = max(0, ans[j]+v[i]);
}
}
return ans;
}
# |
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 |
4 ms |
332 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Execution timed out |
5052 ms |
7344 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 |
201 ms |
8008 KB |
Output is correct |
3 |
Correct |
202 ms |
5908 KB |
Output is correct |
4 |
Execution timed out |
5046 ms |
13352 KB |
Time limit exceeded |
5 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
204 KB |
Output is correct |
2 |
Correct |
1 ms |
204 KB |
Output is correct |
3 |
Correct |
463 ms |
7648 KB |
Output is correct |
4 |
Correct |
460 ms |
3892 KB |
Output is correct |
5 |
Execution timed out |
5064 ms |
10820 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 |
4 ms |
332 KB |
Output is correct |
6 |
Execution timed out |
5052 ms |
7344 KB |
Time limit exceeded |
7 |
Halted |
0 ms |
0 KB |
- |