#include "books.h"
#include <bits/stdc++.h>
using namespace std;
#define ll long long
long long minimum_walk(vector<int> p, int s) {
ll ans=0;
ll n=p.size();
ll ma=0;
ll mi=-1;
for(int i=0;i<n;i++)
{
if(p[i]==i)
{
continue;
}
if(mi==-1)
mi=i;
ma=i;
if(p[i]>i)
ans+=p[i]-i;
}
return ans+ma+mi;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
348 KB |
Output is correct |
2 |
Correct |
0 ms |
348 KB |
Output is correct |
3 |
Incorrect |
0 ms |
348 KB |
3rd lines differ - on the 1st token, expected: '8', found: '7' |
4 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
348 KB |
Output is correct |
2 |
Correct |
0 ms |
348 KB |
Output is correct |
3 |
Incorrect |
0 ms |
348 KB |
3rd lines differ - on the 1st token, expected: '8', found: '7' |
4 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
348 KB |
Output is correct |
2 |
Correct |
0 ms |
348 KB |
Output is correct |
3 |
Incorrect |
0 ms |
348 KB |
3rd lines differ - on the 1st token, expected: '8', found: '7' |
4 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
1 ms |
348 KB |
3rd lines differ - on the 1st token, expected: '3304', found: '2371' |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
348 KB |
Output is correct |
2 |
Correct |
0 ms |
348 KB |
Output is correct |
3 |
Incorrect |
0 ms |
348 KB |
3rd lines differ - on the 1st token, expected: '8', found: '7' |
4 |
Halted |
0 ms |
0 KB |
- |