#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 answer(vector<int>c,vector<int>X,vector<int>Y)
{
for(auto a:c) cout<<a<<" ";
cout<<endl;
for(auto a:X) cout<<a<<" ";
cout<<endl;
for(auto a:Y) cout<<a<<" ";
cout<<endl;
}*/
void create_circuit(int m,vector<int>a)
{
vector<int>c(m+1);
n=sz(a);
c[0]=a[0];
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);
}
/*int main()
{
ios_base::sync_with_stdio(0);
cin.tie(0);
cout.tie(0);
create_circuit(5,{1,2,1,1,1});
return 0;
}*/
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
212 KB |
Output is correct |
2 |
Correct |
37 ms |
4764 KB |
Output is correct |
3 |
Correct |
35 ms |
4168 KB |
Output is correct |
4 |
Correct |
1 ms |
212 KB |
Output is correct |
5 |
Correct |
12 ms |
1492 KB |
Output is correct |
6 |
Correct |
55 ms |
6316 KB |
Output is correct |
7 |
Runtime error |
30 ms |
42196 KB |
Execution killed with signal 11 |
8 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
212 KB |
Output is correct |
2 |
Correct |
37 ms |
4764 KB |
Output is correct |
3 |
Correct |
35 ms |
4168 KB |
Output is correct |
4 |
Correct |
1 ms |
212 KB |
Output is correct |
5 |
Correct |
12 ms |
1492 KB |
Output is correct |
6 |
Correct |
55 ms |
6316 KB |
Output is correct |
7 |
Runtime error |
30 ms |
42196 KB |
Execution killed with signal 11 |
8 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
212 KB |
Output is correct |
2 |
Correct |
37 ms |
4764 KB |
Output is correct |
3 |
Correct |
35 ms |
4168 KB |
Output is correct |
4 |
Correct |
1 ms |
212 KB |
Output is correct |
5 |
Correct |
12 ms |
1492 KB |
Output is correct |
6 |
Correct |
55 ms |
6316 KB |
Output is correct |
7 |
Runtime error |
30 ms |
42196 KB |
Execution killed with signal 11 |
8 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
0 ms |
212 KB |
Output is correct |
2 |
Correct |
0 ms |
212 KB |
Output is correct |
3 |
Correct |
1 ms |
212 KB |
Output is correct |
4 |
Correct |
0 ms |
212 KB |
Output is correct |
5 |
Correct |
0 ms |
212 KB |
Output is correct |
6 |
Correct |
1 ms |
212 KB |
Output is correct |
7 |
Correct |
1 ms |
212 KB |
Output is correct |
8 |
Correct |
1 ms |
212 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
212 KB |
Output is correct |
2 |
Correct |
64 ms |
6728 KB |
Output is correct |
3 |
Correct |
66 ms |
6620 KB |
Output is correct |
4 |
Correct |
92 ms |
10052 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
212 KB |
Output is correct |
2 |
Correct |
64 ms |
6728 KB |
Output is correct |
3 |
Correct |
66 ms |
6620 KB |
Output is correct |
4 |
Correct |
92 ms |
10052 KB |
Output is correct |
5 |
Correct |
107 ms |
10436 KB |
Output is correct |
6 |
Correct |
122 ms |
10176 KB |
Output is correct |
7 |
Correct |
98 ms |
10280 KB |
Output is correct |
8 |
Correct |
101 ms |
10060 KB |
Output is correct |
9 |
Correct |
61 ms |
6640 KB |
Output is correct |
10 |
Correct |
110 ms |
10048 KB |
Output is correct |
11 |
Correct |
101 ms |
10024 KB |
Output is correct |
12 |
Correct |
69 ms |
6564 KB |
Output is correct |
13 |
Correct |
60 ms |
6832 KB |
Output is correct |
14 |
Correct |
66 ms |
7028 KB |
Output is correct |
15 |
Correct |
69 ms |
7068 KB |
Output is correct |
16 |
Correct |
3 ms |
468 KB |
Output is correct |
17 |
Correct |
63 ms |
6728 KB |
Output is correct |
18 |
Correct |
60 ms |
6752 KB |
Output is correct |
19 |
Correct |
66 ms |
6576 KB |
Output is correct |
20 |
Correct |
99 ms |
10168 KB |
Output is correct |
21 |
Correct |
98 ms |
10052 KB |
Output is correct |
22 |
Correct |
113 ms |
10040 KB |
Output is correct |