Submission #901401

#TimeUsernameProblemLanguageResultExecution timeMemory
901401nxteruAncient Books (IOI17_books)C++14
0 / 100
0 ms504 KiB
#include <bits/stdc++.h> using namespace std; using ll =long long; int minimum_walk(vector<int>p, int s){ int n=p.size(); ll ans=0; for(int i=0;i<n;i++){ ans+=abs(p[i]-i); } int r=n-1; while(r>=0&&p[r]==r)r--; int ma=0; for(int i=0;i<r;i++){ ma=max(ma,p[i]); if(ma>i)ans+=2; } 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...