#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define ld long double
#define pb push_back
#define mp make_pair
#define forr(X) for(int i = 0; i<X; i++)
#pragma GCC optimize("Ofast")
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> k(n, 0);
forr(q){
for(int j = l[i]; j<=r[i]; j++){
if(v[i]>0)k[j] = min(c[j], k[j]+v[i]);
else k[j] = max(0, k[j]+v[i]);
}
}
return k;
}
# |
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 |
2 ms |
332 KB |
Output is correct |
4 |
Correct |
1 ms |
332 KB |
Output is correct |
5 |
Correct |
6 ms |
332 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Execution timed out |
5085 ms |
7348 KB |
Time limit exceeded |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
204 KB |
Output is correct |
2 |
Correct |
148 ms |
4952 KB |
Output is correct |
3 |
Correct |
147 ms |
3824 KB |
Output is correct |
4 |
Execution timed out |
5080 ms |
7260 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 |
838 ms |
5016 KB |
Output is correct |
4 |
Correct |
1205 ms |
2792 KB |
Output is correct |
5 |
Execution timed out |
5045 ms |
7260 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 |
1 ms |
204 KB |
Output is correct |
3 |
Correct |
2 ms |
332 KB |
Output is correct |
4 |
Correct |
1 ms |
332 KB |
Output is correct |
5 |
Correct |
6 ms |
332 KB |
Output is correct |
6 |
Execution timed out |
5085 ms |
7348 KB |
Time limit exceeded |
7 |
Halted |
0 ms |
0 KB |
- |