#include <bits/stdc++.h>
#include "candies.h"
using namespace std;
const int maxn = 2e5 + 12;
int a[maxn];
int n, m;
vector<int> distribute_candies(vector<int> c, vector<int> l, vector<int> r, vector<int> v){
n = c.size(), m = l.size();
for(int i=0;i<m;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];
}
}
return vector<int> (a, a+n);
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
348 KB |
Output is correct |
2 |
Correct |
0 ms |
348 KB |
Output is correct |
3 |
Correct |
1 ms |
348 KB |
Output is correct |
4 |
Correct |
1 ms |
348 KB |
Output is correct |
5 |
Correct |
4 ms |
348 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Execution timed out |
5074 ms |
12132 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 |
131 ms |
8040 KB |
Output is correct |
3 |
Correct |
124 ms |
6724 KB |
Output is correct |
4 |
Execution timed out |
5052 ms |
13304 KB |
Time limit exceeded |
5 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
348 KB |
Output is correct |
2 |
Correct |
1 ms |
348 KB |
Output is correct |
3 |
Correct |
803 ms |
7804 KB |
Output is correct |
4 |
Correct |
1593 ms |
4800 KB |
Output is correct |
5 |
Execution timed out |
5068 ms |
11000 KB |
Time limit exceeded |
6 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
348 KB |
Output is correct |
2 |
Correct |
0 ms |
348 KB |
Output is correct |
3 |
Correct |
1 ms |
348 KB |
Output is correct |
4 |
Correct |
1 ms |
348 KB |
Output is correct |
5 |
Correct |
4 ms |
348 KB |
Output is correct |
6 |
Execution timed out |
5074 ms |
12132 KB |
Time limit exceeded |
7 |
Halted |
0 ms |
0 KB |
- |