#include "candies.h"
#include <bits/stdc++.h>
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();
std::vector<int> s(N);
int Q = l.size();
for (int i = 0; i < N; ++i) {
int val = 0;
for (int j = 0; j < Q; ++j) {
if (l[j] > i || r[j] < i) continue;
val += v[j];
if (val < 0) val = 0;
if (val > c[i]) val = c[i];
}
s[i] = val;
}
return s;
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
0 ms |
344 KB |
Output is correct |
2 |
Correct |
0 ms |
348 KB |
Output is correct |
3 |
Correct |
1 ms |
348 KB |
Output is correct |
4 |
Correct |
2 ms |
348 KB |
Output is correct |
5 |
Correct |
7 ms |
544 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Execution timed out |
5078 ms |
12132 KB |
Time limit exceeded |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
344 KB |
Output is correct |
2 |
Correct |
1621 ms |
8288 KB |
Output is correct |
3 |
Correct |
535 ms |
6016 KB |
Output is correct |
4 |
Execution timed out |
5065 ms |
13288 KB |
Time limit exceeded |
5 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
344 KB |
Output is correct |
2 |
Correct |
0 ms |
348 KB |
Output is correct |
3 |
Correct |
660 ms |
7792 KB |
Output is correct |
4 |
Correct |
651 ms |
3932 KB |
Output is correct |
5 |
Execution timed out |
5097 ms |
10820 KB |
Time limit exceeded |
6 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
0 ms |
344 KB |
Output is correct |
2 |
Correct |
0 ms |
348 KB |
Output is correct |
3 |
Correct |
1 ms |
348 KB |
Output is correct |
4 |
Correct |
2 ms |
348 KB |
Output is correct |
5 |
Correct |
7 ms |
544 KB |
Output is correct |
6 |
Execution timed out |
5078 ms |
12132 KB |
Time limit exceeded |
7 |
Halted |
0 ms |
0 KB |
- |