#include <iostream>
#include <cmath>
#include <vector>
#include "candies.h"
using namespace std;
vector<int> distribute_candies(vector<int> c, vector<int> l, vector<int> r, vector<int> v) {
int n = c.size(), q = l.size();
vector<int> ans(n,0);
for (int i=0; i<q; i++) {
for (int j=l[i]; j<=r[i]; j++) {
ans[j] = ((v[i] > 0) ? min(c[j], ans[j]+v[i]) : max(0, ans[j]+v[i]));
}
}
return ans;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
212 KB |
Output is correct |
2 |
Correct |
1 ms |
212 KB |
Output is correct |
3 |
Correct |
1 ms |
340 KB |
Output is correct |
4 |
Correct |
1 ms |
340 KB |
Output is correct |
5 |
Correct |
3 ms |
312 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Execution timed out |
5083 ms |
12072 KB |
Time limit exceeded |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
212 KB |
Output is correct |
2 |
Correct |
192 ms |
8016 KB |
Output is correct |
3 |
Correct |
192 ms |
6012 KB |
Output is correct |
4 |
Execution timed out |
5057 ms |
13228 KB |
Time limit exceeded |
5 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
212 KB |
Output is correct |
2 |
Correct |
1 ms |
212 KB |
Output is correct |
3 |
Correct |
485 ms |
7636 KB |
Output is correct |
4 |
Correct |
455 ms |
4008 KB |
Output is correct |
5 |
Execution timed out |
5057 ms |
10832 KB |
Time limit exceeded |
6 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
212 KB |
Output is correct |
2 |
Correct |
1 ms |
212 KB |
Output is correct |
3 |
Correct |
1 ms |
340 KB |
Output is correct |
4 |
Correct |
1 ms |
340 KB |
Output is correct |
5 |
Correct |
3 ms |
312 KB |
Output is correct |
6 |
Execution timed out |
5083 ms |
12072 KB |
Time limit exceeded |
7 |
Halted |
0 ms |
0 KB |
- |