#include "doll.h"
#include <bits/stdc++.h>
using namespace std;
typedef vector<int> vi;
const int N=5e5+10;
int g[N][2],nw[N];
bool bb[N],usu[N];
void create_circuit(int m, vi a) {
a.push_back(0);
int n=a.size(),w=1;
while(w<n) w*=2;
for(int i=w/2;i<w;i++) usu[i]=1;
for(int i=1;i<w/2;i++) g[i][0]=i*2,g[i][1]=i*2+1;
for(int i=w/2;i<w;i++) g[i][0]=-1,g[i][1]=-1;
for(int i=n;i>=1;i--){
int curr=1;
while(curr<w/2){
bb[curr]^=1;
curr=g[curr][bb[curr]];
}
bb[curr]^=1;
g[curr][bb[curr]]=a[i-1];
usu[curr]=0;
}
for(int i=w/2;i<w;i++){
if(g[i][0]==-1 and g[i][1]==-1) usu[i]=1;
}
for(int i=w/2-1;i>=1;i--){
if(usu[i*2] and usu[i*2+1]) usu[i]=1;
}
int li=0;
for(int i=1;i<w;i++){
if(usu[i]) continue;
nw[i]=++li;
}
vi c,x(li),y(li);
for(int i=0;i<=m;i++) c.push_back(-1);
for(int i=1;i<w/2;i++){
if(usu[i]) continue;
if(usu[i*2]) x[nw[i]-1]=-1;
else x[nw[i]-1]=-nw[g[i][0]];
if(usu[i*2+1]) y[nw[i]-1]=-1;
else y[nw[i]-1]=-nw[g[i][1]];
}
for(int i=w/2;i<w;i++){
if(usu[i]) continue;
if(usu[i*2]) x[nw[i]-1]=-1;
else x[nw[i]-1]=g[i][0];
if(usu[i*2+1]) y[nw[i]-1]=-1;
else y[nw[i]-1]=g[i][1];
}
//for(auto u:x) cout<<u<<"\n";
answer(c,x,y);
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
1 ms |
2396 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
1 ms |
2396 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
1 ms |
2396 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
1 ms |
2396 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Partially correct |
1 ms |
2396 KB |
Output is partially correct |
2 |
Incorrect |
51 ms |
14756 KB |
wrong motion |
3 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Partially correct |
1 ms |
2396 KB |
Output is partially correct |
2 |
Incorrect |
51 ms |
14756 KB |
wrong motion |
3 |
Halted |
0 ms |
0 KB |
- |