#include "candies.h"
#include <bits/stdc++.h>
using namespace std;
const int MAXN = 2e5;
const int T = 700;
int A[MAXN];
vector<int> distribute_candies(vector<int> c, vector<int> l, vector<int> r, vector<int> v) {
int q = l.size(), n = c.size();
vector<int> A(n, 0);
for (int s = 0; s < MAXN; s += T) {
int fl = s, fr = s + T - 1;
for (int i = 0; i < q; i++) {
int tl = (fl > l[i] ? fl : l[i]);
int tr = (fr < r[i] ? fr : r[i]);
for (int j = tl; j <= tr; j++) {
A[j] = A[j] + v[i];
A[j] = (A[j] >= c[j] ? c[j] : A[j]);
A[j] = (A[j] >= 0 ? A[j] : 0);
}
}
}
return A;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
344 KB |
Output is correct |
2 |
Correct |
0 ms |
348 KB |
Output is correct |
3 |
Correct |
2 ms |
604 KB |
Output is correct |
4 |
Correct |
1 ms |
348 KB |
Output is correct |
5 |
Correct |
4 ms |
552 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Execution timed out |
5071 ms |
12116 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 |
238 ms |
8048 KB |
Output is correct |
3 |
Correct |
129 ms |
6040 KB |
Output is correct |
4 |
Execution timed out |
5083 ms |
13392 KB |
Time limit exceeded |
5 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
344 KB |
Output is correct |
2 |
Correct |
0 ms |
348 KB |
Output is correct |
3 |
Correct |
378 ms |
7764 KB |
Output is correct |
4 |
Correct |
329 ms |
4160 KB |
Output is correct |
5 |
Execution timed out |
5049 ms |
10836 KB |
Time limit exceeded |
6 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
344 KB |
Output is correct |
2 |
Correct |
0 ms |
348 KB |
Output is correct |
3 |
Correct |
2 ms |
604 KB |
Output is correct |
4 |
Correct |
1 ms |
348 KB |
Output is correct |
5 |
Correct |
4 ms |
552 KB |
Output is correct |
6 |
Execution timed out |
5071 ms |
12116 KB |
Time limit exceeded |
7 |
Halted |
0 ms |
0 KB |
- |