#include <bits/stdc++.h>
#include "doll.h"
using namespace std;
#define endl '\n'
#define st first
#define nd second
#define pb push_back
#define sz(x) (int)(x).size()
#define all(x) (x).begin(), (x).end()
#define ll long long
ll mod=1000000007;
int inf=1000000007;
ll infl=1000000000000000007;
const int N=200007;
int it,n;
int x[N+20];
int y[N+20];
bool state[N+20];
bool kon[N+20];
void build(int v,int l,int r)
{
if(l+1==r)
{
kon[v]=1;
if(n==l) x[v]=-1;
return ;
}
it++;
y[v]=-it;
build(it,l,(l+r)/2);
if(n>(l+r)/2)
{
it++;
x[v]=-it;
build(it,(l+r)/2+1,r);
}
else x[v]=-1;
}
void push(int v,int k)
{
state[v]^=1;
if(state[v])
{
if(kon[v])
{
if(x[v]==-1) push(1,k);
else x[v]=k;
}
else push(-x[v],k);
}
else
{
if(kon[v])
{
if(y[v]==-1) push(1,k);
else y[v]=k;
}
else push(-y[v],k);
}
}
void create_circuit(int m,vector<int>a)
{
vector<int>c(m+1);
n=sz(a);
c[0]=a[0];
if(n==1)
{
for(int i=1;i<=m;i++) c[i]=0;
answer(c,{},{});
return ;
}
for(int i=1;i<=m;i++) c[i]=-1;
int p=1;
while(p<n) p*=2;
it++;
build(1,1,p);
for(int i=0;i<n-1;i++) push(1,a[i+1]);
push(1,0);
vector<int>X,Y;
for(int i=1;i<=it;i++) X.pb(x[i]);
for(int i=1;i<=it;i++) Y.pb(y[i]);
answer(c,X,Y);
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
0 ms |
212 KB |
Output is correct |
2 |
Correct |
36 ms |
4284 KB |
Output is correct |
3 |
Correct |
33 ms |
3764 KB |
Output is correct |
4 |
Correct |
1 ms |
212 KB |
Output is correct |
5 |
Correct |
9 ms |
1492 KB |
Output is correct |
6 |
Correct |
54 ms |
5700 KB |
Output is correct |
7 |
Correct |
0 ms |
212 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
0 ms |
212 KB |
Output is correct |
2 |
Correct |
36 ms |
4284 KB |
Output is correct |
3 |
Correct |
33 ms |
3764 KB |
Output is correct |
4 |
Correct |
1 ms |
212 KB |
Output is correct |
5 |
Correct |
9 ms |
1492 KB |
Output is correct |
6 |
Correct |
54 ms |
5700 KB |
Output is correct |
7 |
Correct |
0 ms |
212 KB |
Output is correct |
8 |
Correct |
64 ms |
7368 KB |
Output is correct |
9 |
Correct |
70 ms |
7892 KB |
Output is correct |
10 |
Correct |
100 ms |
11076 KB |
Output is correct |
11 |
Correct |
0 ms |
212 KB |
Output is correct |
12 |
Correct |
1 ms |
212 KB |
Output is correct |
13 |
Correct |
1 ms |
212 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
0 ms |
212 KB |
Output is correct |
2 |
Correct |
36 ms |
4284 KB |
Output is correct |
3 |
Correct |
33 ms |
3764 KB |
Output is correct |
4 |
Correct |
1 ms |
212 KB |
Output is correct |
5 |
Correct |
9 ms |
1492 KB |
Output is correct |
6 |
Correct |
54 ms |
5700 KB |
Output is correct |
7 |
Correct |
0 ms |
212 KB |
Output is correct |
8 |
Correct |
64 ms |
7368 KB |
Output is correct |
9 |
Correct |
70 ms |
7892 KB |
Output is correct |
10 |
Correct |
100 ms |
11076 KB |
Output is correct |
11 |
Correct |
0 ms |
212 KB |
Output is correct |
12 |
Correct |
1 ms |
212 KB |
Output is correct |
13 |
Correct |
1 ms |
212 KB |
Output is correct |
14 |
Correct |
103 ms |
10680 KB |
Output is correct |
15 |
Correct |
63 ms |
7104 KB |
Output is correct |
16 |
Correct |
97 ms |
10476 KB |
Output is correct |
17 |
Correct |
0 ms |
212 KB |
Output is correct |
18 |
Correct |
0 ms |
340 KB |
Output is correct |
19 |
Correct |
1 ms |
212 KB |
Output is correct |
20 |
Correct |
98 ms |
10852 KB |
Output is correct |
21 |
Correct |
1 ms |
212 KB |
Output is correct |
22 |
Correct |
0 ms |
212 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 |
0 ms |
212 KB |
Output is correct |
4 |
Correct |
0 ms |
212 KB |
Output is correct |
5 |
Correct |
1 ms |
212 KB |
Output is correct |
6 |
Correct |
0 ms |
212 KB |
Output is correct |
7 |
Correct |
0 ms |
212 KB |
Output is correct |
8 |
Correct |
0 ms |
212 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
212 KB |
Output is correct |
2 |
Correct |
56 ms |
5820 KB |
Output is correct |
3 |
Correct |
59 ms |
5684 KB |
Output is correct |
4 |
Correct |
88 ms |
8548 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
212 KB |
Output is correct |
2 |
Correct |
56 ms |
5820 KB |
Output is correct |
3 |
Correct |
59 ms |
5684 KB |
Output is correct |
4 |
Correct |
88 ms |
8548 KB |
Output is correct |
5 |
Correct |
98 ms |
8904 KB |
Output is correct |
6 |
Correct |
95 ms |
8760 KB |
Output is correct |
7 |
Correct |
99 ms |
8892 KB |
Output is correct |
8 |
Correct |
95 ms |
8584 KB |
Output is correct |
9 |
Correct |
66 ms |
5700 KB |
Output is correct |
10 |
Correct |
93 ms |
8580 KB |
Output is correct |
11 |
Correct |
91 ms |
8640 KB |
Output is correct |
12 |
Correct |
59 ms |
5692 KB |
Output is correct |
13 |
Correct |
59 ms |
5832 KB |
Output is correct |
14 |
Correct |
62 ms |
6008 KB |
Output is correct |
15 |
Correct |
62 ms |
6188 KB |
Output is correct |
16 |
Correct |
2 ms |
468 KB |
Output is correct |
17 |
Correct |
57 ms |
5736 KB |
Output is correct |
18 |
Correct |
57 ms |
5840 KB |
Output is correct |
19 |
Correct |
60 ms |
5688 KB |
Output is correct |
20 |
Correct |
92 ms |
8644 KB |
Output is correct |
21 |
Correct |
94 ms |
8644 KB |
Output is correct |
22 |
Correct |
90 ms |
8664 KB |
Output is correct |