#include "candies.h"
#include <cstdio>
#include <vector>
#include <algorithm>
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(), q = l.size();
std::vector<int> s(n);
for(int i=0; i<q; i++){
for(int j=l[i]; j<=r[i]; j++){
if(v[i] > 0) s[j] = std::min(c[j],s[j]+v[i]);
else s[j] = std::max(0,s[j]+v[i]);
}
}
return s;
}
# |
결과 |
실행 시간 |
메모리 |
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 |
3 ms |
332 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Execution timed out |
5085 ms |
12052 KB |
Time limit exceeded |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
204 KB |
Output is correct |
2 |
Correct |
257 ms |
8004 KB |
Output is correct |
3 |
Correct |
209 ms |
5936 KB |
Output is correct |
4 |
Execution timed out |
5058 ms |
10068 KB |
Time limit exceeded |
5 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
204 KB |
Output is correct |
2 |
Correct |
1 ms |
204 KB |
Output is correct |
3 |
Correct |
495 ms |
7628 KB |
Output is correct |
4 |
Correct |
499 ms |
4020 KB |
Output is correct |
5 |
Execution timed out |
5095 ms |
8484 KB |
Time limit exceeded |
6 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
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 |
3 ms |
332 KB |
Output is correct |
6 |
Execution timed out |
5085 ms |
12052 KB |
Time limit exceeded |
7 |
Halted |
0 ms |
0 KB |
- |