#include "candies.h"
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef vector<int> vi;
#define sz(x) (int)(x).size()
int N, Q;
std::vector<int> distribute_candies(vi c, vi l,
vi r, vi v)
{
N = sz(c);
Q = sz(l);
vi S(N, 0);
for (int q = 0; q < Q; ++q)
{
for (int i = l[q]; i <= r[q]; ++i)
{
S[i] += v[q];
S[i] = max(S[i], 0);
S[i] = min(S[i], c[i]);
}
}
return S;
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
0 ms |
212 KB |
Output is correct |
2 |
Correct |
1 ms |
212 KB |
Output is correct |
3 |
Correct |
1 ms |
340 KB |
Output is correct |
4 |
Correct |
1 ms |
308 KB |
Output is correct |
5 |
Correct |
3 ms |
340 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Execution timed out |
5029 ms |
12080 KB |
Time limit exceeded |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
212 KB |
Output is correct |
2 |
Correct |
188 ms |
8040 KB |
Output is correct |
3 |
Correct |
172 ms |
5964 KB |
Output is correct |
4 |
Execution timed out |
5061 ms |
13272 KB |
Time limit exceeded |
5 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
0 ms |
212 KB |
Output is correct |
2 |
Correct |
1 ms |
212 KB |
Output is correct |
3 |
Correct |
458 ms |
7768 KB |
Output is correct |
4 |
Correct |
449 ms |
3992 KB |
Output is correct |
5 |
Execution timed out |
5049 ms |
10796 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 |
212 KB |
Output is correct |
3 |
Correct |
1 ms |
340 KB |
Output is correct |
4 |
Correct |
1 ms |
308 KB |
Output is correct |
5 |
Correct |
3 ms |
340 KB |
Output is correct |
6 |
Execution timed out |
5029 ms |
12080 KB |
Time limit exceeded |
7 |
Halted |
0 ms |
0 KB |
- |