Submission #300996

#TimeUsernameProblemLanguageResultExecution timeMemory
300996TMJNMechanical Doll (IOI18_doll)C++17
0 / 100
2 ms460 KiB
#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 timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...