#include "doll.h"
#include <bits/stdc++.h>
using namespace std;
#define pb push_back
#define eb emplace_back
#define mp make_pair
#define f first
#define s second
#define all(a) (a).begin(),(a).end()
#define For(i,a,b) for(auto i=(a);i<(b);i++)
#define FOR(i,b) For(i,0,b)
#define Rev(i,a,b) for(auto i=(a);i>(b);i--)
#define REV(i,a) Rev(i,a,-1)
#define FORE(i,a) for(auto&&i:a)
#define sz(a) (int((a).size()))
using ll=long long;using ld=long double;using uint=unsigned int;using ull=unsigned long long;
using pii=pair<int,int>;using pll=pair<ll,ll>;using pill=pair<int,ll>;using plli=pair<ll,int>;using pdd=pair<double,double>;using pld=pair<ld,ld>;
constexpr const char nl='\n',sp=' ';constexpr const int INT_INF=0x3f3f3f3f;constexpr const ll LL_INF=0x3f3f3f3f3f3f3f3f;
constexpr const double D_INF=numeric_limits<double>::infinity();constexpr const ld LD_INF=numeric_limits<ld>::infinity();constexpr const double EPS=1e-9;
const int MAXN = 2e5 + 5;
int N, H, cur = 1, X[MAXN * 2], Y[MAXN * 2];
bool T[MAXN * 2];
int build(int l, int r) {
if (r <= H - N) return 1;
if (l >= r) return 0;
int m = l + (r - l) / 2, ret = cur++;
T[ret] = false;
X[ret] = build(l, m);
Y[ret] = build(m + 1, r);
return ret;
}
void update(int i, int a) {
int &j = T[i] ? Y[i] : X[i];
T[i] = !T[i];
assert(j >= 0);
if (j == 0) j = -a;
else update(j, a);
}
void create_circuit(int M, vector<int> A) {
N = A.size();
for (H = 1; H < N; H *= 2);
build(1, H);
For(i, 1, N) update(1, A[i]);
update(1, 0);
For(i, 1, cur) {
assert(!T[i]);
X[i] = -X[i];
Y[i] = -Y[i];
}
vector<int> C(M + 1, -(N != 1));
C[0] = A[0];
answer(C, vector<int>(X + 1, X + cur), vector<int>(Y + 1, Y + cur));
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
204 KB |
Output is correct |
2 |
Correct |
54 ms |
3592 KB |
Output is correct |
3 |
Correct |
51 ms |
3120 KB |
Output is correct |
4 |
Correct |
1 ms |
288 KB |
Output is correct |
5 |
Correct |
13 ms |
1484 KB |
Output is correct |
6 |
Correct |
67 ms |
4660 KB |
Output is correct |
7 |
Correct |
1 ms |
204 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
204 KB |
Output is correct |
2 |
Correct |
54 ms |
3592 KB |
Output is correct |
3 |
Correct |
51 ms |
3120 KB |
Output is correct |
4 |
Correct |
1 ms |
288 KB |
Output is correct |
5 |
Correct |
13 ms |
1484 KB |
Output is correct |
6 |
Correct |
67 ms |
4660 KB |
Output is correct |
7 |
Correct |
1 ms |
204 KB |
Output is correct |
8 |
Correct |
82 ms |
5292 KB |
Output is correct |
9 |
Correct |
86 ms |
5692 KB |
Output is correct |
10 |
Correct |
150 ms |
7860 KB |
Output is correct |
11 |
Correct |
1 ms |
204 KB |
Output is correct |
12 |
Correct |
1 ms |
204 KB |
Output is correct |
13 |
Correct |
1 ms |
204 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
204 KB |
Output is correct |
2 |
Correct |
54 ms |
3592 KB |
Output is correct |
3 |
Correct |
51 ms |
3120 KB |
Output is correct |
4 |
Correct |
1 ms |
288 KB |
Output is correct |
5 |
Correct |
13 ms |
1484 KB |
Output is correct |
6 |
Correct |
67 ms |
4660 KB |
Output is correct |
7 |
Correct |
1 ms |
204 KB |
Output is correct |
8 |
Correct |
82 ms |
5292 KB |
Output is correct |
9 |
Correct |
86 ms |
5692 KB |
Output is correct |
10 |
Correct |
150 ms |
7860 KB |
Output is correct |
11 |
Correct |
1 ms |
204 KB |
Output is correct |
12 |
Correct |
1 ms |
204 KB |
Output is correct |
13 |
Correct |
1 ms |
204 KB |
Output is correct |
14 |
Correct |
124 ms |
7544 KB |
Output is correct |
15 |
Correct |
81 ms |
4932 KB |
Output is correct |
16 |
Correct |
132 ms |
7424 KB |
Output is correct |
17 |
Correct |
1 ms |
204 KB |
Output is correct |
18 |
Correct |
1 ms |
204 KB |
Output is correct |
19 |
Correct |
1 ms |
204 KB |
Output is correct |
20 |
Correct |
133 ms |
7600 KB |
Output is correct |
21 |
Correct |
1 ms |
204 KB |
Output is correct |
22 |
Correct |
1 ms |
204 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
204 KB |
Output is correct |
2 |
Correct |
1 ms |
204 KB |
Output is correct |
3 |
Correct |
1 ms |
204 KB |
Output is correct |
4 |
Correct |
1 ms |
204 KB |
Output is correct |
5 |
Correct |
1 ms |
204 KB |
Output is correct |
6 |
Correct |
1 ms |
204 KB |
Output is correct |
7 |
Correct |
1 ms |
204 KB |
Output is correct |
8 |
Correct |
1 ms |
204 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
204 KB |
Output is correct |
2 |
Correct |
74 ms |
4532 KB |
Output is correct |
3 |
Correct |
74 ms |
4536 KB |
Output is correct |
4 |
Correct |
120 ms |
6712 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
204 KB |
Output is correct |
2 |
Correct |
74 ms |
4532 KB |
Output is correct |
3 |
Correct |
74 ms |
4536 KB |
Output is correct |
4 |
Correct |
120 ms |
6712 KB |
Output is correct |
5 |
Correct |
124 ms |
7252 KB |
Output is correct |
6 |
Correct |
119 ms |
7360 KB |
Output is correct |
7 |
Correct |
127 ms |
7420 KB |
Output is correct |
8 |
Correct |
120 ms |
7060 KB |
Output is correct |
9 |
Correct |
76 ms |
4548 KB |
Output is correct |
10 |
Correct |
117 ms |
6928 KB |
Output is correct |
11 |
Correct |
118 ms |
6692 KB |
Output is correct |
12 |
Correct |
84 ms |
4548 KB |
Output is correct |
13 |
Correct |
103 ms |
4828 KB |
Output is correct |
14 |
Correct |
82 ms |
4908 KB |
Output is correct |
15 |
Correct |
85 ms |
5032 KB |
Output is correct |
16 |
Correct |
3 ms |
460 KB |
Output is correct |
17 |
Correct |
77 ms |
4652 KB |
Output is correct |
18 |
Correct |
74 ms |
4548 KB |
Output is correct |
19 |
Correct |
89 ms |
4544 KB |
Output is correct |
20 |
Correct |
124 ms |
6792 KB |
Output is correct |
21 |
Correct |
114 ms |
6720 KB |
Output is correct |
22 |
Correct |
121 ms |
6716 KB |
Output is correct |