#include "doll.h"
#include<bits/stdc++.h>
#define pb push_back
#define x first
#define y second
#define all(a) (a).begin(), (a).end()
using namespace std;
typedef long long ll;
typedef pair<int, int> ii;
const int inf = 1e9;
int P = 0, SZ = 0;
vector<int> state;
int gen_switch(int N, int &S, vector<int> &X, vector<int> &Y) {
if(N == 1) {SZ++;return inf;}
int L = gen_switch((N + 1) / 2, S, X, Y);
int R = gen_switch((N + 1) / 2, S, X, Y);
int root = --S;
state.pb(0);
X.pb(L), Y.pb(R);
return root;
}
int simulate(int x, vector<int> &A, vector<int> &X, vector<int> &Y) {
if(x == inf) return A[P++];
int pos = -x - 1;
if(state[pos] == 0) X[pos] = simulate(X[pos], A, X, Y);
if(state[pos] == 1) Y[pos] = simulate(Y[pos], A, X, Y);
state[pos] ^= 1;
return x;
}
void create_circuit(int M, vector<int> A) {
A.pb(0);
int S = 0, N = (int)A.size();
vector<int> C, X, Y;
int root = gen_switch(N, S, X, Y);
vector<int> v;
for(int i = N;i < SZ;i++) v.pb(root);
for(int i : A) v.pb(i);
A = v;
N = (int)A.size();
for(int i = 0;i < N;i++) simulate(root, A, X, Y);
C = vector<int>(M + 1, root);
answer(C, X, Y);
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
1 ms |
212 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
1 ms |
212 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
1 ms |
212 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
1 ms |
308 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Partially correct |
1 ms |
212 KB |
Output is partially correct |
2 |
Partially correct |
122 ms |
11116 KB |
Output is partially correct |
3 |
Partially correct |
116 ms |
11124 KB |
Output is partially correct |
4 |
Partially correct |
134 ms |
13328 KB |
Output is partially correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Partially correct |
1 ms |
212 KB |
Output is partially correct |
2 |
Partially correct |
122 ms |
11116 KB |
Output is partially correct |
3 |
Partially correct |
116 ms |
11124 KB |
Output is partially correct |
4 |
Partially correct |
134 ms |
13328 KB |
Output is partially correct |
5 |
Partially correct |
119 ms |
13324 KB |
Output is partially correct |
6 |
Partially correct |
119 ms |
13328 KB |
Output is partially correct |
7 |
Partially correct |
123 ms |
13244 KB |
Output is partially correct |
8 |
Partially correct |
114 ms |
13332 KB |
Output is partially correct |
9 |
Partially correct |
114 ms |
11124 KB |
Output is partially correct |
10 |
Partially correct |
118 ms |
13324 KB |
Output is partially correct |
11 |
Partially correct |
116 ms |
13336 KB |
Output is partially correct |
12 |
Partially correct |
112 ms |
11128 KB |
Output is partially correct |
13 |
Partially correct |
122 ms |
11084 KB |
Output is partially correct |
14 |
Partially correct |
126 ms |
11116 KB |
Output is partially correct |
15 |
Partially correct |
119 ms |
11208 KB |
Output is partially correct |
16 |
Partially correct |
3 ms |
724 KB |
Output is partially correct |
17 |
Correct |
56 ms |
7772 KB |
Output is correct |
18 |
Partially correct |
118 ms |
11080 KB |
Output is partially correct |
19 |
Partially correct |
113 ms |
11120 KB |
Output is partially correct |
20 |
Partially correct |
123 ms |
13324 KB |
Output is partially correct |
21 |
Partially correct |
116 ms |
13324 KB |
Output is partially correct |
22 |
Partially correct |
113 ms |
13340 KB |
Output is partially correct |