# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
901389 | 2024-01-09T11:31:04 Z | nxteru | Ancient Books (IOI17_books) | C++14 | 0 ms | 0 KB |
using ll =long long; int minimum_walk(int[] p, int s){ int n=sizeof(p); ll ans=0; int ma=0; for(int i=0;i<n;i++){ ans+=abs(p[i]-i); ma=max(ma,p[i]); if(ma<=i&&i<n-1)ans+=2; } return ans; }