#pragma GCC optimize("O3")
#pragma GCC optimize("unroll-loops")
#pragma GCC target("avx")
#include "candies.h"
#include <bits/stdc++.h>
using namespace std;
const int MAXN = 2e5;
const int T = 500;
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;
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
0 ms |
212 KB |
Output is correct |
2 |
Correct |
0 ms |
212 KB |
Output is correct |
3 |
Correct |
1 ms |
340 KB |
Output is correct |
4 |
Correct |
1 ms |
340 KB |
Output is correct |
5 |
Correct |
2 ms |
340 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1983 ms |
7368 KB |
Output is correct |
2 |
Correct |
1983 ms |
7372 KB |
Output is correct |
3 |
Correct |
1992 ms |
7372 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
212 KB |
Output is correct |
2 |
Correct |
137 ms |
4976 KB |
Output is correct |
3 |
Correct |
56 ms |
3772 KB |
Output is correct |
4 |
Correct |
2032 ms |
7372 KB |
Output is correct |
5 |
Correct |
1991 ms |
7372 KB |
Output is correct |
6 |
Correct |
1986 ms |
7372 KB |
Output is correct |
7 |
Correct |
1992 ms |
7372 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
0 ms |
212 KB |
Output is correct |
2 |
Correct |
0 ms |
212 KB |
Output is correct |
3 |
Correct |
161 ms |
4984 KB |
Output is correct |
4 |
Correct |
85 ms |
2820 KB |
Output is correct |
5 |
Correct |
4977 ms |
7372 KB |
Output is correct |
6 |
Correct |
4974 ms |
7884 KB |
Output is correct |
7 |
Execution timed out |
5011 ms |
7868 KB |
Time limit exceeded |
8 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
0 ms |
212 KB |
Output is correct |
2 |
Correct |
0 ms |
212 KB |
Output is correct |
3 |
Correct |
1 ms |
340 KB |
Output is correct |
4 |
Correct |
1 ms |
340 KB |
Output is correct |
5 |
Correct |
2 ms |
340 KB |
Output is correct |
6 |
Correct |
1983 ms |
7368 KB |
Output is correct |
7 |
Correct |
1983 ms |
7372 KB |
Output is correct |
8 |
Correct |
1992 ms |
7372 KB |
Output is correct |
9 |
Correct |
1 ms |
212 KB |
Output is correct |
10 |
Correct |
137 ms |
4976 KB |
Output is correct |
11 |
Correct |
56 ms |
3772 KB |
Output is correct |
12 |
Correct |
2032 ms |
7372 KB |
Output is correct |
13 |
Correct |
1991 ms |
7372 KB |
Output is correct |
14 |
Correct |
1986 ms |
7372 KB |
Output is correct |
15 |
Correct |
1992 ms |
7372 KB |
Output is correct |
16 |
Correct |
0 ms |
212 KB |
Output is correct |
17 |
Correct |
0 ms |
212 KB |
Output is correct |
18 |
Correct |
161 ms |
4984 KB |
Output is correct |
19 |
Correct |
85 ms |
2820 KB |
Output is correct |
20 |
Correct |
4977 ms |
7372 KB |
Output is correct |
21 |
Correct |
4974 ms |
7884 KB |
Output is correct |
22 |
Execution timed out |
5011 ms |
7868 KB |
Time limit exceeded |
23 |
Halted |
0 ms |
0 KB |
- |