이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include "doll.h"
#include <bits/stdc++.h>
using namespace std;
int log_2(int x){
return 31-__builtin_clz(x);
}
bool state[400005];
int fi;
void create_circuit(int M, vector<int> A) {
int N = A.size();
int S=(1<<(log_2(N-1)+1))-1;
vector<int> C(M + 1),X(S+1),Y(S+1);
for (int i = 1; i <= S; ++i)
{
if((2*i)<=S)X[i]=-i*2;
else{
X[i]=-i;
if(!fi)fi=-i;
}
if((2*i+1)<=S)Y[i]=-i*2-1;
else Y[i]=-i;
}
C[0]=1,C[1]=-1;
N--;
for (int i = 0; i < S+1; ++i)
{
int r=-1;
while(r>fi){
state[-r]=(!state[-r]);
if(state[-r])r=X[-r];
else r=Y[-r];
}
//cerr<<r<<"\n";
if(i<N && i!=S){
if(!state[-r])X[-r]=1;
else Y[-r]=1;
}
else if(i!=S){
if(!state[-r])X[-r]=-1;
else Y[-r]=-1;
}
else{
if(!state[-r])X[-r]=0;
else Y[-r]=0;
}
state[-r]=(!state[-r]);
}
/*for (int i = 1; i <= S; ++i)
{
cerr<<-i<<" : ";
cerr<<X[i]<<","<<Y[i]<<"\n";
}*/
X.erase(X.begin()),Y.erase(Y.begin());
answer(C, X, Y);
}
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |