#include "candies.h"
#include <bits/stdc++.h>
using namespace std;
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, 0);
for (int time = 0; time < q; time++) {
int L = l[time], R = r[time], V = v[time];
for (int i = L; i <= R; i++) {
if (V > 0) s[i] = min(c[i], s[i] + V);
else s[i] = max(0, s[i] + V);
}
}
return s;
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
204 KB |
Output is correct |
2 |
Correct |
1 ms |
204 KB |
Output is correct |
3 |
Correct |
2 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 |
5049 ms |
7284 KB |
Time limit exceeded |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
204 KB |
Output is correct |
2 |
Correct |
233 ms |
5012 KB |
Output is correct |
3 |
Correct |
204 ms |
3820 KB |
Output is correct |
4 |
Execution timed out |
5038 ms |
7268 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 |
484 ms |
5016 KB |
Output is correct |
4 |
Correct |
476 ms |
2792 KB |
Output is correct |
5 |
Execution timed out |
5053 ms |
7364 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 |
2 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 |
5049 ms |
7284 KB |
Time limit exceeded |
7 |
Halted |
0 ms |
0 KB |
- |