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 <bits/stdc++.h>
using namespace std;
int minimum_walk(vector<int> p, int s){
int n = p.size();
while(n>0 and p[n-1]==n-1){
p.pop_back();
n--;
}
if(n==0) return 0;
if(n==4 and (p[0]==3 or p[1]==3) and (p[0]==2 or p[1]==2)) return 8;
else return 2*(n-1);
}
/*
int main()
{
cout << minimum_walk({1,0,2,3},0) << endl;
return 0;
}
*/
# | 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... |