#include "candies.h"
#include "bits/stdc++.h"
using namespace std;
#define vi vector<int>
vi distribute_candies(vi c, vi l, vi r, vi v) {
int n = c.size();
int q=l.size();
vector<int> res(n,0);
for(int i=0;i<q;i++){
for(int j=l[i];j<=r[i];j++){
res[j]+=v[i];
if(res[j]>c[j]) res[j]=c[j];
if(res[j]<0) res[j]=0;
}
}
return res;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
212 KB |
Output is correct |
2 |
Correct |
0 ms |
212 KB |
Output is correct |
3 |
Correct |
1 ms |
340 KB |
Output is correct |
4 |
Correct |
1 ms |
340 KB |
Output is correct |
5 |
Correct |
3 ms |
340 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Execution timed out |
5040 ms |
7276 KB |
Time limit exceeded |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
212 KB |
Output is correct |
2 |
Correct |
239 ms |
5028 KB |
Output is correct |
3 |
Correct |
219 ms |
3832 KB |
Output is correct |
4 |
Execution timed out |
5087 ms |
7268 KB |
Time limit exceeded |
5 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
212 KB |
Output is correct |
2 |
Correct |
1 ms |
212 KB |
Output is correct |
3 |
Correct |
484 ms |
5080 KB |
Output is correct |
4 |
Correct |
497 ms |
2804 KB |
Output is correct |
5 |
Execution timed out |
5046 ms |
7276 KB |
Time limit exceeded |
6 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
212 KB |
Output is correct |
2 |
Correct |
0 ms |
212 KB |
Output is correct |
3 |
Correct |
1 ms |
340 KB |
Output is correct |
4 |
Correct |
1 ms |
340 KB |
Output is correct |
5 |
Correct |
3 ms |
340 KB |
Output is correct |
6 |
Execution timed out |
5040 ms |
7276 KB |
Time limit exceeded |
7 |
Halted |
0 ms |
0 KB |
- |