#include <bits/stdc++.h>
using namespace std;
#include "candies.h"
vector<int> distribute_candies(vector<int> c, vector<int> l, vector<int> r, vector<int> v){
int N = c.size(), Q = v.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] = max(0, ans[j] + v[i]);
else if(v[i] > 0) ans[j] = min(c[j], ans[j] + v[i]);
}
}
return ans;
}
# |
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 |
2 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 |
5094 ms |
7232 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 |
222 ms |
5072 KB |
Output is correct |
3 |
Correct |
229 ms |
6012 KB |
Output is correct |
4 |
Execution timed out |
5014 ms |
13252 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 |
590 ms |
5020 KB |
Output is correct |
4 |
Correct |
586 ms |
2796 KB |
Output is correct |
5 |
Execution timed out |
5089 ms |
7236 KB |
Time limit exceeded |
6 |
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 |
2 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 |
5094 ms |
7232 KB |
Time limit exceeded |
7 |
Halted |
0 ms |
0 KB |
- |