#include "candies.h"
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
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(n);
for(ll i=0;i<q;i++){
for(ll j=l[i];j<=r[i];j++){
if(v[i]>0){
s[j] = min(s[j]+v[i],c[j]);
}else{
s[j] = max(s[j]+v[i],0);
}
}
}
return s;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
348 KB |
Output is correct |
2 |
Correct |
0 ms |
348 KB |
Output is correct |
3 |
Correct |
0 ms |
348 KB |
Output is correct |
4 |
Correct |
0 ms |
348 KB |
Output is correct |
5 |
Correct |
1 ms |
348 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Execution timed out |
5038 ms |
7252 KB |
Time limit exceeded |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
344 KB |
Output is correct |
2 |
Correct |
105 ms |
8016 KB |
Output is correct |
3 |
Correct |
99 ms |
5956 KB |
Output is correct |
4 |
Execution timed out |
5072 ms |
13396 KB |
Time limit exceeded |
5 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
600 KB |
Output is correct |
2 |
Correct |
0 ms |
348 KB |
Output is correct |
3 |
Correct |
250 ms |
7780 KB |
Output is correct |
4 |
Correct |
264 ms |
4024 KB |
Output is correct |
5 |
Execution timed out |
5024 ms |
10832 KB |
Time limit exceeded |
6 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
348 KB |
Output is correct |
2 |
Correct |
0 ms |
348 KB |
Output is correct |
3 |
Correct |
0 ms |
348 KB |
Output is correct |
4 |
Correct |
0 ms |
348 KB |
Output is correct |
5 |
Correct |
1 ms |
348 KB |
Output is correct |
6 |
Execution timed out |
5038 ms |
7252 KB |
Time limit exceeded |
7 |
Halted |
0 ms |
0 KB |
- |