Submission #301000

#TimeUsernameProblemLanguageResultExecution timeMemory
301000TMJNMechanical Doll (IOI18_doll)C++17
2 / 100
26 ms3116 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); A.pop_back(); 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...