#include "candies.h"
#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();
std::vector<int> s(n);
for (int i = 0; i < (int) l.size(); i++) {
for (int j = l[i]; j <= r[i]; j++) {
if (v[i] < 0) {
s[j] += v[i];
if (s[j] < 0)
s[j] = 0;
} else {
s[j] += v[i];
if (s[j] > c[j])
s[j] = c[j];
}
}
}
return s;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 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 |
300 KB |
Output is correct |
5 |
Correct |
3 ms |
332 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Execution timed out |
5067 ms |
11708 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 |
204 ms |
8024 KB |
Output is correct |
3 |
Correct |
195 ms |
6012 KB |
Output is correct |
4 |
Execution timed out |
5065 ms |
11716 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 |
492 ms |
7640 KB |
Output is correct |
4 |
Correct |
456 ms |
3892 KB |
Output is correct |
5 |
Execution timed out |
5090 ms |
10788 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 |
0 ms |
204 KB |
Output is correct |
3 |
Correct |
1 ms |
332 KB |
Output is correct |
4 |
Correct |
1 ms |
300 KB |
Output is correct |
5 |
Correct |
3 ms |
332 KB |
Output is correct |
6 |
Execution timed out |
5067 ms |
11708 KB |
Time limit exceeded |
7 |
Halted |
0 ms |
0 KB |
- |