#include<bits/stdc++.h>
#include"books.h"
using namespace std;
long long minimum_walk(vector<int> a,int s){
int n=a.size();
while(n&&a[n-1]==n-1)n--;
long long ans=0;
for(int i=0;i<n;i++)ans+=abs(i-a[i]);
int pivot=0;
for(int i=0;i+1<n;i--){
pivot=max(pivot,a[i]);
if(i==pivot)ans+=2;
}
return ans;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Execution timed out |
2066 ms |
364 KB |
Time limit exceeded |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Execution timed out |
2066 ms |
364 KB |
Time limit exceeded |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Execution timed out |
2066 ms |
364 KB |
Time limit exceeded |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Execution timed out |
2069 ms |
364 KB |
Time limit exceeded |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Execution timed out |
2066 ms |
364 KB |
Time limit exceeded |
2 |
Halted |
0 ms |
0 KB |
- |