#include "candies.h"
#include <vector>
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> res(n, 0);
for(int j = 0; j < q; j++)
{
for(int i = l[j]; i <= r[j]; i++)
{
if(v[j] > 0)
res[i] = min(res[i] + v[j], c[i]);
else
res[i] = max(res[i] + v[j], 0);
}
}
return res;
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
0 ms |
204 KB |
Output is correct |
2 |
Correct |
0 ms |
280 KB |
Output is correct |
3 |
Correct |
1 ms |
332 KB |
Output is correct |
4 |
Correct |
1 ms |
296 KB |
Output is correct |
5 |
Correct |
3 ms |
332 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Execution timed out |
5048 ms |
8400 KB |
Time limit exceeded |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
204 KB |
Output is correct |
2 |
Correct |
210 ms |
8112 KB |
Output is correct |
3 |
Correct |
208 ms |
5940 KB |
Output is correct |
4 |
Execution timed out |
5070 ms |
13124 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 |
485 ms |
6224 KB |
Output is correct |
4 |
Correct |
489 ms |
3636 KB |
Output is correct |
5 |
Execution timed out |
5058 ms |
8076 KB |
Time limit exceeded |
6 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
0 ms |
204 KB |
Output is correct |
2 |
Correct |
0 ms |
280 KB |
Output is correct |
3 |
Correct |
1 ms |
332 KB |
Output is correct |
4 |
Correct |
1 ms |
296 KB |
Output is correct |
5 |
Correct |
3 ms |
332 KB |
Output is correct |
6 |
Execution timed out |
5048 ms |
8400 KB |
Time limit exceeded |
7 |
Halted |
0 ms |
0 KB |
- |