#include "candies.h"
#include <vector>
#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<int> s(n,0);
int q=l.size();
for(int i = 0 ; i < q ; i++){
for(int j = l[i] ; j <= r[i] ; j ++){
if(v[i] > 0) s[j] = min(c[j],s[j]+v[i]);
else s[j] = max(0,s[j]+v[i]);
}
}
return s;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
212 KB |
Output is correct |
2 |
Correct |
1 ms |
212 KB |
Output is correct |
3 |
Correct |
2 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 |
5024 ms |
12116 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 |
182 ms |
8016 KB |
Output is correct |
3 |
Correct |
180 ms |
5904 KB |
Output is correct |
4 |
Execution timed out |
5019 ms |
13280 KB |
Time limit exceeded |
5 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
212 KB |
Output is correct |
2 |
Correct |
1 ms |
212 KB |
Output is correct |
3 |
Correct |
423 ms |
7660 KB |
Output is correct |
4 |
Correct |
397 ms |
4016 KB |
Output is correct |
5 |
Execution timed out |
5042 ms |
10844 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 |
1 ms |
212 KB |
Output is correct |
3 |
Correct |
2 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 |
5024 ms |
12116 KB |
Time limit exceeded |
7 |
Halted |
0 ms |
0 KB |
- |