#include "candies.h"
#include <bits/stdc++.h>
using namespace std;
const int N=2e5+5;
int n,q;
std::vector<int> distribute_candies(std::vector<int> c, std::vector<int> l,
std::vector<int> r, std::vector<int> v) {
n=c.size();
q=l.size();
vector<int> a(n,0);
for (int j=0;j<q;j++){
for (int i=l[j];i<=r[j];i++){
a[i]+=v[j];
if (a[i]<0) a[i]=0;
if (a[i]>c[i]) a[i]=c[i];
}
}return a;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
600 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 |
2 ms |
348 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Execution timed out |
5018 ms |
12112 KB |
Time limit exceeded |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
348 KB |
Output is correct |
2 |
Correct |
130 ms |
7964 KB |
Output is correct |
3 |
Correct |
128 ms |
5956 KB |
Output is correct |
4 |
Execution timed out |
5033 ms |
13392 KB |
Time limit exceeded |
5 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
344 KB |
Output is correct |
2 |
Correct |
1 ms |
348 KB |
Output is correct |
3 |
Correct |
326 ms |
7616 KB |
Output is correct |
4 |
Correct |
293 ms |
4032 KB |
Output is correct |
5 |
Execution timed out |
5078 ms |
10836 KB |
Time limit exceeded |
6 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
600 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 |
2 ms |
348 KB |
Output is correct |
6 |
Execution timed out |
5018 ms |
12112 KB |
Time limit exceeded |
7 |
Halted |
0 ms |
0 KB |
- |