#include "candies.h"
#include <vector>
using namespace std;
#include <bits/stdc++.h>
std::vector<int> distribute_candies(std::vector<int> c, std::vector<int> l,
std::vector<int> r, std::vector<int> v) {
int n = c.size(), q = v.size();
vector<int> s(n);
for (int i = 0; i < q; ++i) {
for (int k = l[i]; k <= r[i]; ++k) {
s[k] += v[i];
if (s[k] > c[k]) s[k] = c[k];
if (s[k] <= 0) s[k] = 0;
}
}
return s;
}
# |
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 |
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 |
5048 ms |
7224 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 |
231 ms |
4960 KB |
Output is correct |
3 |
Correct |
223 ms |
3836 KB |
Output is correct |
4 |
Execution timed out |
5042 ms |
7264 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 |
550 ms |
5016 KB |
Output is correct |
4 |
Correct |
552 ms |
2792 KB |
Output is correct |
5 |
Execution timed out |
5092 ms |
7268 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 |
1 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 |
5048 ms |
7224 KB |
Time limit exceeded |
7 |
Halted |
0 ms |
0 KB |
- |