#include <bits/stdc++.h>
#include "candies.h"
using namespace std;
const int maxn = 2e5+10;
int value(int v, int add, int C)
{
if (add + v > C) return C;
if (add + v < 0) return 0;
return add+v;
}
int a[maxn];
vector<int> distribute_candies(vector<int> c, vector<int> L, vector<int> R, vector<int> V)
{
int n = c.size(), q = L.size();
for (int i = 0; i < q; i++)
{
for (int j = L[i]; j <= R[i]; j++)
a[j] = value(a[j], V[i], c[j]);
}
vector<int> ans;
for (int i = 0; i < n; i++)
ans.push_back(a[i]);
return ans;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
204 KB |
Output is correct |
2 |
Correct |
0 ms |
204 KB |
Output is correct |
3 |
Correct |
1 ms |
332 KB |
Output is correct |
4 |
Correct |
1 ms |
332 KB |
Output is correct |
5 |
Correct |
5 ms |
332 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Execution timed out |
5099 ms |
7228 KB |
Time limit exceeded |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
204 KB |
Output is correct |
2 |
Correct |
217 ms |
5032 KB |
Output is correct |
3 |
Correct |
210 ms |
4644 KB |
Output is correct |
4 |
Execution timed out |
5099 ms |
7236 KB |
Time limit exceeded |
5 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
204 KB |
Output is correct |
2 |
Correct |
1 ms |
204 KB |
Output is correct |
3 |
Correct |
1025 ms |
5028 KB |
Output is correct |
4 |
Correct |
1529 ms |
3840 KB |
Output is correct |
5 |
Execution timed out |
5072 ms |
7236 KB |
Time limit exceeded |
6 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
204 KB |
Output is correct |
2 |
Correct |
0 ms |
204 KB |
Output is correct |
3 |
Correct |
1 ms |
332 KB |
Output is correct |
4 |
Correct |
1 ms |
332 KB |
Output is correct |
5 |
Correct |
5 ms |
332 KB |
Output is correct |
6 |
Execution timed out |
5099 ms |
7228 KB |
Time limit exceeded |
7 |
Halted |
0 ms |
0 KB |
- |