Submission #1061318

#TimeUsernameProblemLanguageResultExecution timeMemory
1061318fv3Ancient Books (IOI17_books)C++14
12 / 100
0 ms600 KiB
#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 * 2; return res; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...