#include "candies.h"
#include <bits/stdc++.h>
using namespace std;
const int mxN=200100;
int N, Q;
int A[mxN];
vector <int> ans;
std::vector<int> distribute_candies(vector <int> c, vector <int> l,
vector <int> r, vector <int> v) {
N=c.size();
ans.resize(N);
Q=v.size();
for(int i=0;i<Q;i++)
{
for(int j=l[i];j<=r[i];j++)
{
A[j]+=v[i];
if(A[j]<0) A[j]=0;
if(A[j]>c[j]) A[j]=c[j];
}
}
for(int i=0;i<N;i++) ans[i]=A[i];
return ans;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
204 KB |
Output is correct |
2 |
Correct |
0 ms |
204 KB |
Output is correct |
3 |
Correct |
1 ms |
332 KB |
Output is correct |
4 |
Correct |
2 ms |
332 KB |
Output is correct |
5 |
Correct |
7 ms |
332 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Execution timed out |
5061 ms |
9152 KB |
Time limit exceeded |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
332 KB |
Output is correct |
2 |
Correct |
212 ms |
6040 KB |
Output is correct |
3 |
Correct |
224 ms |
6476 KB |
Output is correct |
4 |
Execution timed out |
5039 ms |
9212 KB |
Time limit exceeded |
5 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
204 KB |
Output is correct |
2 |
Correct |
1 ms |
204 KB |
Output is correct |
3 |
Correct |
1719 ms |
6064 KB |
Output is correct |
4 |
Correct |
2313 ms |
5504 KB |
Output is correct |
5 |
Execution timed out |
5052 ms |
9264 KB |
Time limit exceeded |
6 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
204 KB |
Output is correct |
2 |
Correct |
0 ms |
204 KB |
Output is correct |
3 |
Correct |
1 ms |
332 KB |
Output is correct |
4 |
Correct |
2 ms |
332 KB |
Output is correct |
5 |
Correct |
7 ms |
332 KB |
Output is correct |
6 |
Execution timed out |
5061 ms |
9152 KB |
Time limit exceeded |
7 |
Halted |
0 ms |
0 KB |
- |