#include "candies.h"
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
std::vector<signed> distribute_candies(std::vector<signed> c, std::vector<signed> l,
std::vector<signed> r, std::vector<signed> v) {
ll n = c.size(), Q = l.size();
vector<signed> ans(n);
for(ll i = 0; i < Q; ++i) {
for(ll j = l[i]; j <= r[i]; ++j) {
ans[j] += v[i];
ans[j] = max(0, ans[j]);
ans[j] = min(c[j], ans[j]);
}
}
return ans;
}
/*
*/
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
348 KB |
Output is correct |
2 |
Correct |
0 ms |
348 KB |
Output is correct |
3 |
Correct |
0 ms |
348 KB |
Output is correct |
4 |
Correct |
0 ms |
348 KB |
Output is correct |
5 |
Correct |
2 ms |
348 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Execution timed out |
5096 ms |
7420 KB |
Time limit exceeded |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
344 KB |
Output is correct |
2 |
Correct |
114 ms |
5160 KB |
Output is correct |
3 |
Correct |
101 ms |
5952 KB |
Output is correct |
4 |
Execution timed out |
5050 ms |
13276 KB |
Time limit exceeded |
5 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
344 KB |
Output is correct |
2 |
Correct |
0 ms |
448 KB |
Output is correct |
3 |
Correct |
277 ms |
4948 KB |
Output is correct |
4 |
Correct |
254 ms |
3652 KB |
Output is correct |
5 |
Execution timed out |
5073 ms |
10836 KB |
Time limit exceeded |
6 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
348 KB |
Output is correct |
2 |
Correct |
0 ms |
348 KB |
Output is correct |
3 |
Correct |
0 ms |
348 KB |
Output is correct |
4 |
Correct |
0 ms |
348 KB |
Output is correct |
5 |
Correct |
2 ms |
348 KB |
Output is correct |
6 |
Execution timed out |
5096 ms |
7420 KB |
Time limit exceeded |
7 |
Halted |
0 ms |
0 KB |
- |