#include "candies.h"
#include <bits/stdc++.h>
using namespace std;
const int MAXN = 2e5;
int A[MAXN];
vector<int> distribute_candies(vector<int> c, vector<int> l, vector<int> r, vector<int> v) {
int q = l.size(), n = c.size();
for (int i = 0; i < q; i++) {
if (v[i] >= 0) {
for (int j = l[i]; j <= r[i]; j++) {
A[j] = (A[j] + v[i] >= c[j] ? c[j] : A[j] + v[i]);
}
} else {
for (int j = l[i]; j <= r[i]; j++) {
A[j] = (A[j] + v[i] >= 0 ? A[j] + v[i] : 0);
}
}
}
vector<int> ans;
for (int i = 0; i < n; i++) ans.push_back(A[i]);
return ans;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
212 KB |
Output is correct |
2 |
Correct |
0 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 |
2 ms |
376 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Execution timed out |
5045 ms |
7312 KB |
Time limit exceeded |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
212 KB |
Output is correct |
2 |
Correct |
138 ms |
5036 KB |
Output is correct |
3 |
Correct |
132 ms |
4628 KB |
Output is correct |
4 |
Execution timed out |
5041 ms |
7244 KB |
Time limit exceeded |
5 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
212 KB |
Output is correct |
2 |
Correct |
1 ms |
212 KB |
Output is correct |
3 |
Correct |
317 ms |
5036 KB |
Output is correct |
4 |
Correct |
304 ms |
3788 KB |
Output is correct |
5 |
Execution timed out |
5029 ms |
7240 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 |
0 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 |
2 ms |
376 KB |
Output is correct |
6 |
Execution timed out |
5045 ms |
7312 KB |
Time limit exceeded |
7 |
Halted |
0 ms |
0 KB |
- |