#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;
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
0 ms |
504 KB |
3rd lines differ - on the 1st token, expected: '6', found: '8' |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
0 ms |
504 KB |
3rd lines differ - on the 1st token, expected: '6', found: '8' |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
0 ms |
504 KB |
3rd lines differ - on the 1st token, expected: '6', found: '8' |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
0 ms |
344 KB |
3rd lines differ - on the 1st token, expected: '3304', found: '4742' |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
0 ms |
504 KB |
3rd lines differ - on the 1st token, expected: '6', found: '8' |
2 |
Halted |
0 ms |
0 KB |
- |