This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#include "doll.h"
#include <bits/stdc++.h>
using namespace std;
void create_circuit(int M,vector<int>A) {
vector<int>X,Y,C(M+1,0);
A.push_back(0);
int f=0;
for(int i:A){
C[f]=i;
f=i;
}
vector<bool>B(400000,false);
int p=0;
vector<int>T;
do{
if(p>=0){
if(p)T.push_back(p);
p=C[p];
}
else{
if(B[-p-1]){
B[-p-1]=!B[-p-1];
p=Y[-p-1];
}
else{
B[-p-1]=!B[-p-1];
p=X[-p-1];
}
}
}while(p);
assert(A==T);
bool F=false;
for(int i=0;i<400000;i++){
F|=B[i];
}
assert(!F);
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... |