#include "candies.h"
#include<bits/stdc++.h>
#include <vector>
using namespace std;
#define ll long long
vector<int> distribute_candies(vector<int> c, vector<int> l,
vector<int> r, vector<int> v) {
int n = c.size();
int q=v.size();
vector<ll> s(n);
// if(n<=2000&&q<=2000){
for(int j=0;j<q;j++){
int lrr=l[j],rr=r[j],cc=v[j];
for(int i=lrr;i<=rr;i++){
s[i]=max(0LL,min((long long)c[i],s[i]+cc));
}
}
// }else{
// }
vector<int> ans;
for(auto x:s) ans.push_back(x);
return ans;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 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 |
2 ms |
340 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Execution timed out |
5022 ms |
8032 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 |
171 ms |
4952 KB |
Output is correct |
3 |
Correct |
177 ms |
6800 KB |
Output is correct |
4 |
Execution timed out |
5101 ms |
14036 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 |
450 ms |
5028 KB |
Output is correct |
4 |
Correct |
485 ms |
5820 KB |
Output is correct |
5 |
Execution timed out |
5046 ms |
11600 KB |
Time limit exceeded |
6 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 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 |
2 ms |
340 KB |
Output is correct |
6 |
Execution timed out |
5022 ms |
8032 KB |
Time limit exceeded |
7 |
Halted |
0 ms |
0 KB |
- |