#include "candies.h"
#include <vector>
std::vector<int> distribute_candies(std::vector<int> c, std::vector<int> l,
std::vector<int> r, std::vector<int> v) {
int n = c.size();
int q=l.size();
std::vector<int> s(n);
for(int i=0;i<q;i++){
int x=l[i];
int y=r[i];
for(int j=x;j<=y;j++){
s[j]+=v[i];
if(s[j]>c[j])s[j]=c[j];
if(s[j]<0)s[j]=0;
}
}
return s;
}
# |
결과 |
실행 시간 |
메모리 |
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 |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Execution timed out |
5057 ms |
12108 KB |
Time limit exceeded |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
212 KB |
Output is correct |
2 |
Correct |
167 ms |
8020 KB |
Output is correct |
3 |
Correct |
157 ms |
5948 KB |
Output is correct |
4 |
Execution timed out |
5072 ms |
13128 KB |
Time limit exceeded |
5 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
284 KB |
Output is correct |
2 |
Correct |
1 ms |
212 KB |
Output is correct |
3 |
Correct |
408 ms |
7640 KB |
Output is correct |
4 |
Correct |
419 ms |
3900 KB |
Output is correct |
5 |
Execution timed out |
5055 ms |
10824 KB |
Time limit exceeded |
6 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
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 |
5057 ms |
12108 KB |
Time limit exceeded |
7 |
Halted |
0 ms |
0 KB |
- |