#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;
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();
for (int s = 0; s < MAXN; s += 100) {
int fl = s, fr = s + 100;
for (int i = 0; i < q; i++) {
int tl = (fl > l[i] ? fl : l[i]);
int tr = (fr < r[i] ? fr : r[i]);
if (v[i] >= 0) {
for (int j = tl; j <= tr; j++) {
A[j] = (A[j] + v[i] >= c[j] ? c[j] : A[j] + v[i]);
}
} else {
for (int j = tl; j <= tr; j++) {
A[j] = (A[j] + v[i] >= 0 ? A[j] + v[i] : 0);
}
}
}
}
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 |
1 ms |
312 KB |
Output is correct |
2 |
Correct |
0 ms |
212 KB |
Output is correct |
3 |
Correct |
10 ms |
380 KB |
Output is correct |
4 |
Correct |
10 ms |
376 KB |
Output is correct |
5 |
Incorrect |
10 ms |
340 KB |
Output isn't correct |
6 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
4413 ms |
8944 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
340 KB |
Output is correct |
2 |
Correct |
2487 ms |
5292 KB |
Output is correct |
3 |
Incorrect |
79 ms |
4932 KB |
Output isn't correct |
4 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
212 KB |
Output is correct |
2 |
Correct |
1 ms |
340 KB |
Output is correct |
3 |
Correct |
2545 ms |
5208 KB |
Output is correct |
4 |
Correct |
135 ms |
4036 KB |
Output is correct |
5 |
Execution timed out |
5068 ms |
7388 KB |
Time limit exceeded |
6 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
312 KB |
Output is correct |
2 |
Correct |
0 ms |
212 KB |
Output is correct |
3 |
Correct |
10 ms |
380 KB |
Output is correct |
4 |
Correct |
10 ms |
376 KB |
Output is correct |
5 |
Incorrect |
10 ms |
340 KB |
Output isn't correct |
6 |
Halted |
0 ms |
0 KB |
- |