#include "candies.h"
#include <bits/stdc++.h>
using namespace std;
vector<int> distribute_candies(vector<int> c, vector<int> l,
vector<int> r, vector<int> v) {
int n = c.size();
vector<long long int> sum(n + 1, 0);
for(int i = 0; i < (int)v.size(); i++){
sum[l[i]] += v[i] * 1LL;
sum[r[i] + 1] -= v[i] * 1LL;
}
for(int i = 1; i < n; i++) sum[i] += sum[i - 1];
for(int i = 0; i < n; i++) c[i] = min(c[i] * 1LL, sum[i]);
return c;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
204 KB |
Output is correct |
2 |
Incorrect |
1 ms |
296 KB |
Output isn't correct |
3 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
122 ms |
8128 KB |
Output is correct |
2 |
Correct |
101 ms |
12108 KB |
Output is correct |
3 |
Correct |
96 ms |
11984 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
0 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 |
Correct |
0 ms |
204 KB |
Output is correct |
2 |
Incorrect |
1 ms |
296 KB |
Output isn't correct |
3 |
Halted |
0 ms |
0 KB |
- |