This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#include "books.h"
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
ll minimum_walk(vector<int> P, int S)
{
const int N = P.size();
ll res = 0;
for (int i = 0; i < N; i++)
{
res += abs(P[i] - i);
}
int sort_length = 0;
while (sort_length < N && P[sort_length] == sort_length)
sort_length++;
if (sort_length < N)
res += sort_length;
return res;
}
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |