// without pragmas
#include <bits/stdc++.h>
using namespace std;
#define fi first
#define se second
#define pb push_back
typedef long long ll;
typedef pair<int, int> ii;
typedef vector<int> vi;
#include "candies.h"
vi distribute_candies(vi C, vi L, vi R, vi V) {
int N = C.size();
int Q = V.size();
vi ans(N, 0);
for (int i = 0; i < Q; i++) {
for (int j = L[i]; j <= R[i]; j++) {
ans[j] += V[i];
ans[j] = max(ans[j], 0);
ans[j] = min(ans[j], C[j]);
}
}
return ans;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
348 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 |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Execution timed out |
5055 ms |
10140 KB |
Time limit exceeded |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
348 KB |
Output is correct |
2 |
Correct |
127 ms |
6852 KB |
Output is correct |
3 |
Correct |
123 ms |
5188 KB |
Output is correct |
4 |
Execution timed out |
5067 ms |
9556 KB |
Time limit exceeded |
5 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
348 KB |
Output is correct |
2 |
Correct |
0 ms |
348 KB |
Output is correct |
3 |
Correct |
285 ms |
5100 KB |
Output is correct |
4 |
Correct |
280 ms |
2884 KB |
Output is correct |
5 |
Execution timed out |
5093 ms |
7248 KB |
Time limit exceeded |
6 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
348 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 |
5055 ms |
10140 KB |
Time limit exceeded |
7 |
Halted |
0 ms |
0 KB |
- |