#include <bits/stdc++.h>
#include "candies.h"
using namespace std;
using lli = long long;
vector<int> distribute_candies(vector<int> cs, vector<int> ls, vector<int> rs, vector<int> xs) {
int n = cs.size(), q = ls.size();
vector<lli> parcial(n + 1);
for (int qq = 0; qq < q; ++qq) {
parcial[ls[qq]] += xs[qq];
parcial[rs[qq] + 1] -= xs[qq];
}
for (int i = 1; i < n; ++i)
parcial[i] += parcial[i-1];
vector<int> ans(n);
for (int i = 0; i < n; ++i)
ans[i] = min(parcial[i], 1LL*cs[i]);
return ans;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
348 KB |
Output is correct |
2 |
Incorrect |
1 ms |
348 KB |
Output isn't correct |
3 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
79 ms |
8952 KB |
Output is correct |
2 |
Correct |
76 ms |
12884 KB |
Output is correct |
3 |
Correct |
75 ms |
12880 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
1 ms |
348 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
0 ms |
348 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
348 KB |
Output is correct |
2 |
Incorrect |
1 ms |
348 KB |
Output isn't correct |
3 |
Halted |
0 ms |
0 KB |
- |