#include "candies.h"
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
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> res(N);
for (int q = 0; q < Q; q++)
{
for (int i = l[q]; i <= r[q]; i++)
{
if (v[q] > 0)
res[i] = min(c[i], res[i] + v[q]);
else
res[i] = max(0, res[i] + v[q]);
}
}
return res;
}
# |
결과 |
실행 시간 |
메모리 |
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 |
1 ms |
348 KB |
Output is correct |
5 |
Correct |
2 ms |
348 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Execution timed out |
5061 ms |
7256 KB |
Time limit exceeded |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
344 KB |
Output is correct |
2 |
Correct |
138 ms |
8160 KB |
Output is correct |
3 |
Correct |
118 ms |
5952 KB |
Output is correct |
4 |
Execution timed out |
5049 ms |
13396 KB |
Time limit exceeded |
5 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
348 KB |
Output is correct |
2 |
Correct |
0 ms |
348 KB |
Output is correct |
3 |
Correct |
300 ms |
5156 KB |
Output is correct |
4 |
Correct |
341 ms |
2884 KB |
Output is correct |
5 |
Execution timed out |
5027 ms |
7408 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 |
1 ms |
348 KB |
Output is correct |
5 |
Correct |
2 ms |
348 KB |
Output is correct |
6 |
Execution timed out |
5061 ms |
7256 KB |
Time limit exceeded |
7 |
Halted |
0 ms |
0 KB |
- |