#include <iostream>
#include <algorithm>
#include "books.h"
using namespace std;
typedef long long int ll;
typedef pair<ll,ll> pll;
int N,S;
ll P[1000006];
ll ans;
long long minimum_walk(std::vector<int> q, int s) {
N=q.size();
S=s;
for(ll i=0;i<N;i++){
P[i]=q[i];
ans+=abs(P[i]-i);
}
for(ll i=0;P[i]!=i;i++)
ans+=2;
for(ll i=N-1;P[i]!=i;i--)
ans-=2;
return ans;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
3 ms |
376 KB |
3rd lines differ - on the 1st token, expected: '6', found: '-2' |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
3 ms |
376 KB |
3rd lines differ - on the 1st token, expected: '6', found: '-2' |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
3 ms |
376 KB |
3rd lines differ - on the 1st token, expected: '6', found: '-2' |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
3 ms |
376 KB |
3rd lines differ - on the 1st token, expected: '3304', found: '2740' |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
3 ms |
376 KB |
3rd lines differ - on the 1st token, expected: '6', found: '-2' |
2 |
Halted |
0 ms |
0 KB |
- |