#include <bits/stdc++.h>
#include "candies.h"
using namespace std;
vector<int>distribute_candies(vector<int>c,vector<int>l,vector<int>r,vector<int>v) {
int N = c.size();
int Q = l.size();
vector<int> S;
for (int i = 0; i < N; i ++)
S.push_back(0);
for (int i = 0; i < Q; i ++) {
for (int j = l[i]; j <= r[i]; j ++) {
if (v[i] > 0)
S[j] = min(c[j], S[j] + v[i]);
else
S[j] = max(0, S[j] + v[i]);
}
}
return S;
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
0 ms |
212 KB |
Output is correct |
2 |
Correct |
1 ms |
300 KB |
Output is correct |
3 |
Correct |
1 ms |
340 KB |
Output is correct |
4 |
Correct |
1 ms |
340 KB |
Output is correct |
5 |
Correct |
3 ms |
340 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Execution timed out |
5012 ms |
8048 KB |
Time limit exceeded |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
212 KB |
Output is correct |
2 |
Correct |
202 ms |
8012 KB |
Output is correct |
3 |
Correct |
189 ms |
6148 KB |
Output is correct |
4 |
Execution timed out |
5031 ms |
13636 KB |
Time limit exceeded |
5 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
212 KB |
Output is correct |
2 |
Correct |
1 ms |
212 KB |
Output is correct |
3 |
Correct |
492 ms |
7760 KB |
Output is correct |
4 |
Correct |
466 ms |
4164 KB |
Output is correct |
5 |
Execution timed out |
5056 ms |
11304 KB |
Time limit exceeded |
6 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
0 ms |
212 KB |
Output is correct |
2 |
Correct |
1 ms |
300 KB |
Output is correct |
3 |
Correct |
1 ms |
340 KB |
Output is correct |
4 |
Correct |
1 ms |
340 KB |
Output is correct |
5 |
Correct |
3 ms |
340 KB |
Output is correct |
6 |
Execution timed out |
5012 ms |
8048 KB |
Time limit exceeded |
7 |
Halted |
0 ms |
0 KB |
- |