이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include<bits/stdc++.h>
#include "doll.h"
using namespace std;
const int DECA=(1<<18),INFINI=1000*1000*1000;
int nbDec,longChaine,date,decalage;
vector<int> chaine,direc,prem,deuz;
int arbreBin[2*DECA],tour[2*DECA];
void chute(int pos,int id) {
if (pos<decalage) {
chute(2*pos+tour[pos],id);
tour[pos]=1-tour[pos];
}
else {
arbreBin[pos]=chaine[id];
}
}
void create_circuit(int M,vector<int> A) {
nbDec=M;
longChaine=A.size();
chaine=A;
decalage=1;
while (decalage<longChaine+1) {
decalage*=2;
}
for (int i=1;i<2*DECA;i++) {
arbreBin[i]=INFINI;
}
for (int i=0;i<=nbDec;i++) {
direc.push_back(-1);
}
for (int i=0;i<longChaine;i++) {
chute(1,i);
}
arbreBin[2*decalage-1]=0;
for (int i=decalage-1;i>0;i--) {
if (arbreBin[2*i]!=INFINI or arbreBin[2*i+1]!=INFINI) {
arbreBin[i]=0;
}
}
date=-1;
for (int i=1;i<decalage;i++) {
if (arbreBin[i]==0) {
arbreBin[i]=date;
date--;
}
}
for (int i=1;i<decalage;i++) {
if (arbreBin[i]<0) {
if (arbreBin[2*i]!=INFINI) {
prem.push_back(arbreBin[2*i]);
}
else {
prem.push_back(-1);
}
if (arbreBin[2*i+1]!=INFINI) {
deuz.push_back(arbreBin[2*i+1]);
}
else {
deuz.push_back(-1);
}
}
}
/*for (int i=0;i<direc.size();i++) {
cout<<direc[0]<<" ";
}
cout<<endl;
for (int i=0;i<prem.size();i++) {
cout<<prem[i]<<" "<<deuz[i]<<endl;
}*/
answer(direc,prem,deuz);
}
# | 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... |