이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include "doll.h"
#include <bits/stdc++.h>
using namespace std;
int tree[1<<18];
void create_circuit(int M, vector<int> A)
{
int N=A.size()+1, c=-1, SZ=1;
vector<int> C(M+1,-1), X(1), Y(1), temp;
A.push_back(0);
for(;SZ<N;SZ<<=1);
memset(tree,0x7f,sizeof(tree));
for(int i=0;i<N;i++) {
int j=0;
for(int b=1;b<SZ;b<<=1) {
j<<=1;
if((SZ-1-i)&b) j|=1;
}
temp.push_back(j);
}
sort(temp.begin(),temp.end());
for(int i=0;i<N;i++) {
int j=0;
for(int b=1;b<SZ;b<<=1) {
j<<=1;
if(temp[i]&b) j|=1;
}
tree[SZ+j]=A[i];
}
for(int i=SZ;--i>1;) if(tree[2*i]!=0x7f7f7f7f || tree[2*i+1]!=0x7f7f7f7f) {
tree[i]=--c;
X.push_back(tree[2*i]==0x7f7f7f7f ? -1:tree[2*i]);
Y.push_back(tree[2*i+1]==0x7f7f7f7f ? -1:tree[2*i+1]);
}
tree[1]=-1;
X[0]=tree[2]==0x7f7f7f7f ? tree[2]:-1;
Y[0]=tree[3]==0x7f7f7f7f ? tree[3]:-1;
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... |