#include "candies.h"
#include <bits/stdc++.h>
#include <vector>
using namespace std;
std::vector<int> distribute_candies(std::vector<int> c, std::vector<int> l, std::vector<int> r, std::vector<int> v) {
int box = c.size();
vector<int> partial;
partial.resize(box + 1);
int e = l.size();
for (int i = 0; i < e; i++) {
partial[l[i]] = v[i];
partial[r[i] + 1] = 0 - v[i];
}
vector<int> cum;
cum.resize(box);
cum[0] = partial[0];
for (int i = 1; i < box; i++) {
cum.push_back(cum[i - 1] + partial[i]);
}
vector<int> res;
res.resize(box);
for (int i = 0; i < box; i++) {
res[i] = min(c[i], cum[i]);
}
return res;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
1 ms |
204 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
134 ms |
9680 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
1 ms |
204 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
1 ms |
204 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
1 ms |
204 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |