#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, 0), sum(n + 1, 0);
for(int i = 0; i < (int)v.size(); i++){
for(int j = l[i]; j <= r[i]; j++){
if(v[i] > 0) s[j] = min(c[j], s[j] + v[i]);
else s[j] = max(0, s[j] + v[i]);
}
}
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 |
300 KB |
Output is correct |
4 |
Correct |
1 ms |
332 KB |
Output is correct |
5 |
Correct |
3 ms |
300 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Execution timed out |
5029 ms |
8032 KB |
Time limit exceeded |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
204 KB |
Output is correct |
2 |
Correct |
207 ms |
8040 KB |
Output is correct |
3 |
Correct |
192 ms |
6012 KB |
Output is correct |
4 |
Execution timed out |
5034 ms |
14040 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 |
288 KB |
Output is correct |
3 |
Correct |
485 ms |
7660 KB |
Output is correct |
4 |
Correct |
461 ms |
4804 KB |
Output is correct |
5 |
Execution timed out |
5096 ms |
11548 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 |
300 KB |
Output is correct |
4 |
Correct |
1 ms |
332 KB |
Output is correct |
5 |
Correct |
3 ms |
300 KB |
Output is correct |
6 |
Execution timed out |
5029 ms |
8032 KB |
Time limit exceeded |
7 |
Halted |
0 ms |
0 KB |
- |