#include <bits/stdc++.h>
using namespace std;
#define a first
#define b second
#define pb push_back
typedef long long llo;
#include "candies.h"
#include <vector>
int cur[200001];
std::vector<int> distribute_candies(vector<int> it,vector<int> ll,
vector<int> rr,vector<int> aa) {
int n=it.size();
int q=ll.size();
for(int i=0;i<n;i++){
cur[i]=0;
}
for(int i=0;i<q;i++){
for(int j=ll[i];j<=rr[i];j++){
cur[j]+=aa[i];
cur[j]=max(cur[j],0);
cur[j]=min(cur[j],it[j]);
}
}
vector<int> ans;
for(int i=0;i<n;i++){
ans.pb(cur[i]);
}
return ans;
}
# |
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 |
1 ms |
332 KB |
Output is correct |
4 |
Correct |
1 ms |
332 KB |
Output is correct |
5 |
Correct |
4 ms |
332 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Execution timed out |
5036 ms |
7236 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 |
282 ms |
5028 KB |
Output is correct |
3 |
Correct |
332 ms |
4708 KB |
Output is correct |
4 |
Execution timed out |
5028 ms |
7272 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 |
708 ms |
5024 KB |
Output is correct |
4 |
Correct |
669 ms |
3828 KB |
Output is correct |
5 |
Execution timed out |
5045 ms |
7276 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 |
1 ms |
332 KB |
Output is correct |
4 |
Correct |
1 ms |
332 KB |
Output is correct |
5 |
Correct |
4 ms |
332 KB |
Output is correct |
6 |
Execution timed out |
5036 ms |
7236 KB |
Time limit exceeded |
7 |
Halted |
0 ms |
0 KB |
- |