#pragma GCC optimize("O3")
#pragma GCC optimize("unroll-loops")
#pragma GCC target("avx2")
#include "candies.h"
#include <bits/stdc++.h>
using namespace std;
const int MAXN = 2e5;
const int T = 1000;
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 < n; s += T) {
int fl = s, fr = (s + T - 1 >= n ? n - 1 : s + T - 1);
for (int i = 0; i < q; i++) {
int tl = (fl > l[i] ? fl : 0);
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 ? 0 : A[j]);
}
}
}
return A;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
212 KB |
Output is correct |
2 |
Incorrect |
0 ms |
212 KB |
Output isn't correct |
3 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Execution timed out |
5085 ms |
7272 KB |
Time limit exceeded |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
1 ms |
212 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
212 KB |
Output is correct |
2 |
Correct |
0 ms |
212 KB |
Output is correct |
3 |
Correct |
129 ms |
4952 KB |
Output is correct |
4 |
Correct |
127 ms |
2800 KB |
Output is correct |
5 |
Execution timed out |
5069 ms |
7244 KB |
Time limit exceeded |
6 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
212 KB |
Output is correct |
2 |
Incorrect |
0 ms |
212 KB |
Output isn't correct |
3 |
Halted |
0 ms |
0 KB |
- |