#include <bits/stdc++.h>
#include "candies.h"
using namespace std;
vector<int>distribute_candies(vector<int>c,vector<int>l,vector<int>r,vector<int>v) {
int N = c.size();
int Q = l.size();
vector<int> S;
for (int i=0;i<N;i++)
S.push_back(0);
for (int i=0;i<Q;i++) {
S[l[i]]+=v[i];
if (r[i]+1!=N)
S[r[i]+1]-=v[i];
}
for (int i=1;i<N;i ++)
S[i]+=S[i - 1];
for (int i=0;i<N;i++)
S[i]=min(S[i],c[i]);
return S;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
1 ms |
212 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
112 ms |
12088 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
1 ms |
212 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
1 ms |
212 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
1 ms |
212 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |