#include "candies.h"
#include <bits/stdc++.h>
typedef std::vector<int> ivec;
#define int long long
ivec distribute_candies(ivec c, ivec l,
ivec r, ivec v) {
int N = c.size();
int Q = l.size();
ivec ans(N);
int diff[N + 1];
for (int i = 0; i <= N; ++i) {
diff[i] = 0;
}
for (int i = 0; i < Q; ++i) {
diff[l[i]] += v[i];
diff[r[i] + 1] -= v[i];
}
for (int i = 1; i <= N; ++i) {
diff[i] += diff[i - 1];
assert(diff[i] >= 0);
}
assert(diff[N] == 0);
for (int i = 0; i < N; ++i) {
ans[i] = std::min<signed>(diff[i], c[i]);
}
return ans;
}
# |
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 |
97 ms |
8960 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Runtime error |
1 ms |
604 KB |
Execution killed with signal 6 |
2 |
Halted |
0 ms |
0 KB |
- |
# |
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 |
1 ms |
348 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |