Submission #612023

#TimeUsernameProblemLanguageResultExecution timeMemory
612023ShithilaAncient Books (IOI17_books)C++14
12 / 100
1 ms296 KiB
#include "books.h" long long minimum_walk(std::vector<int> p, int s) { int len=p.size(); int correct=true; int count=0; for(int i=len-1;i>0;i--) { if(p[i]!=i) { correct=false; break; } count++; } if(correct==true) return 0; else if(count==0 && len>3) { if(p[2]==0 && p[3]==1) { return 8; } else if(p[2]==1 && p[3]==0) { return 8; } else { int ans=len-count-1; ans=ans+ans; return ans; } } else { int ans=len-count-1; ans=ans+ans; return ans; } }
#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...