#include "doll.h"
//#include "grader.cpp"
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define pii pair<int,int>
#define f first
#define s second
#define all(x) x.begin(),x.end()
#define _ ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
const int inf=1e9;
void create_circuit(int m, std::vector<int> a) {
int n=a.size();
int lg=__lg(n-1)+1;
vector<int> state(1<<lg);
vector<vector<int>> to(1<<lg,vector<int>(2,inf));
for(int i=1;i<(1<<lg);i++){
if(i*2<(1<<lg)) to[i][0]=-(i*2);
if(i*2+1<(1<<lg)) to[i][1]=-(i*2+1);
}
for(int i=0;i<n-1;i++){
int nxt=a[i+1];
int cur=1;
while(to[cur][state[cur]]!=inf){
state[cur]^=1;
cur=-to[cur][state[cur]^1];
}
to[cur][state[cur]]=nxt;
state[cur]^=1;
}
for(int i=n-1;i<(1<<lg);i++){
int nxt=(i==(1<<lg)-1?0:-1);
int cur=1;
while(to[cur][state[cur]]!=inf){
state[cur]^=1;
cur=-to[cur][state[cur]^1];
}
to[cur][state[cur]]=nxt;
state[cur]^=1;
}
vector<int> c(m+1,-1);
c[0]=a[0];
vector<int> x((1<<lg)-1),y((1<<lg)-1);
for(int i=1;i<(1<<lg);i++){
x[i-1]=to[i][0];
y[i-1]=to[i][1];
}
answer(c,x,y);
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
0 ms |
344 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
0 ms |
344 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
0 ms |
344 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
600 KB |
Output is correct |
2 |
Correct |
0 ms |
348 KB |
Output is correct |
3 |
Correct |
1 ms |
600 KB |
Output is correct |
4 |
Correct |
0 ms |
440 KB |
Output is correct |
5 |
Correct |
0 ms |
348 KB |
Output is correct |
6 |
Correct |
1 ms |
348 KB |
Output is correct |
7 |
Correct |
0 ms |
348 KB |
Output is correct |
8 |
Correct |
0 ms |
348 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Partially correct |
0 ms |
348 KB |
Output is partially correct |
2 |
Correct |
71 ms |
13156 KB |
Output is correct |
3 |
Partially correct |
175 ms |
23888 KB |
Output is partially correct |
4 |
Partially correct |
157 ms |
25016 KB |
Output is partially correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Partially correct |
0 ms |
348 KB |
Output is partially correct |
2 |
Correct |
71 ms |
13156 KB |
Output is correct |
3 |
Partially correct |
175 ms |
23888 KB |
Output is partially correct |
4 |
Partially correct |
157 ms |
25016 KB |
Output is partially correct |
5 |
Partially correct |
172 ms |
25508 KB |
Output is partially correct |
6 |
Partially correct |
170 ms |
25168 KB |
Output is partially correct |
7 |
Partially correct |
173 ms |
25256 KB |
Output is partially correct |
8 |
Partially correct |
170 ms |
24916 KB |
Output is partially correct |
9 |
Partially correct |
169 ms |
23888 KB |
Output is partially correct |
10 |
Partially correct |
184 ms |
24876 KB |
Output is partially correct |
11 |
Partially correct |
168 ms |
24916 KB |
Output is partially correct |
12 |
Partially correct |
162 ms |
23892 KB |
Output is partially correct |
13 |
Correct |
73 ms |
13156 KB |
Output is correct |
14 |
Partially correct |
171 ms |
24148 KB |
Output is partially correct |
15 |
Partially correct |
180 ms |
24180 KB |
Output is partially correct |
16 |
Partially correct |
3 ms |
1116 KB |
Output is partially correct |
17 |
Correct |
84 ms |
13168 KB |
Output is correct |
18 |
Correct |
75 ms |
13156 KB |
Output is correct |
19 |
Partially correct |
173 ms |
23892 KB |
Output is partially correct |
20 |
Partially correct |
181 ms |
24916 KB |
Output is partially correct |
21 |
Partially correct |
175 ms |
25012 KB |
Output is partially correct |
22 |
Partially correct |
188 ms |
24916 KB |
Output is partially correct |