#include "doll.h"
#include <bits/stdc++.h>
using namespace std;
//macros
typedef long long ll;
typedef pair<int, int> ii;
typedef tuple<int, int, int> iii;
typedef vector<int> vi;
typedef vector<ii> vii;
typedef vector<iii> viii;
typedef vector<ll> vll;
#define REP(a,b,c) for(int a=int(b); a<int(c); a++)
#define RE(a,c) REP(a,0,c)
#define RE1(a,c) REP(a,1,c+1)
#define REI(a,b,c) REP(a,b,c+1)
#define REV(a,b,c) for(int a=int(c-1); a>=int(b); a--)
#define INF 1e9
#define pb push_back
#define fi first
#define se second
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
int n, s;
vi c, x, y, a, state;
int LOG2(int _X) {
int cur=1;
int cnt=0;
while(1) {
if(cur >= _X) {
return cnt;
}
cnt++;
cur *= 2;
}
}
int createTriangle(int size) {
if(size == 0) {
return 0;
}
int i=s;
s++;
int id = (0-s);
int nx = createTriangle(size-1);
int ny = createTriangle(size-1);
x[i] = nx;
y[i] = ny;
return id;
}
void setTriangle(int u, int value) {
u = (0-1-u);
if(state[u]) {
if(y[u] == 0) y[u] = value;
else setTriangle(y[u], value);
} else {
if(x[u] == 0) x[u] = value;
else setTriangle(x[u], value);
}
if(state[u] == 1) state[u] = 0;
else state[u] = 1;
}
void create_circuit(int m, vi A) {
a = A;
s = 0;
a.push_back(0);
n = a.size();
c.clear(); x.clear(); y.clear(); state.clear();
int mx=3e5;
x.resize(mx);
y.resize(mx);
state.resize(mx);
RE(i,mx) state[i]=0;
int l2 = LOG2(n);
int root = createTriangle(l2);
int empty = (1<<l2) - n;
RE(i,empty) setTriangle(root,root);
RE(i,n) setTriangle(root, a[i]);
c.resize(m+1);
RE(i,m+1) c[i] = root;
x.resize(s);
y.resize(s);
answer(c, x, y);
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
3 ms |
3788 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
3 ms |
3788 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
3 ms |
3788 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
4 ms |
3788 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Partially correct |
3 ms |
3788 KB |
Output is partially correct |
2 |
Partially correct |
156 ms |
9496 KB |
Output is partially correct |
3 |
Partially correct |
223 ms |
9544 KB |
Output is partially correct |
4 |
Partially correct |
201 ms |
10280 KB |
Output is partially correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Partially correct |
3 ms |
3788 KB |
Output is partially correct |
2 |
Partially correct |
156 ms |
9496 KB |
Output is partially correct |
3 |
Partially correct |
223 ms |
9544 KB |
Output is partially correct |
4 |
Partially correct |
201 ms |
10280 KB |
Output is partially correct |
5 |
Partially correct |
175 ms |
11260 KB |
Output is partially correct |
6 |
Partially correct |
195 ms |
11000 KB |
Output is partially correct |
7 |
Partially correct |
206 ms |
11128 KB |
Output is partially correct |
8 |
Partially correct |
176 ms |
10764 KB |
Output is partially correct |
9 |
Partially correct |
182 ms |
9456 KB |
Output is partially correct |
10 |
Partially correct |
224 ms |
10620 KB |
Output is partially correct |
11 |
Partially correct |
205 ms |
10368 KB |
Output is partially correct |
12 |
Partially correct |
174 ms |
9712 KB |
Output is partially correct |
13 |
Partially correct |
171 ms |
10088 KB |
Output is partially correct |
14 |
Partially correct |
179 ms |
10216 KB |
Output is partially correct |
15 |
Partially correct |
160 ms |
10320 KB |
Output is partially correct |
16 |
Partially correct |
7 ms |
4044 KB |
Output is partially correct |
17 |
Correct |
90 ms |
8296 KB |
Output is correct |
18 |
Partially correct |
208 ms |
9692 KB |
Output is partially correct |
19 |
Partially correct |
198 ms |
9700 KB |
Output is partially correct |
20 |
Partially correct |
243 ms |
10504 KB |
Output is partially correct |
21 |
Partially correct |
198 ms |
10260 KB |
Output is partially correct |
22 |
Partially correct |
184 ms |
10304 KB |
Output is partially correct |