Submission #1052973

#TimeUsernameProblemLanguageResultExecution timeMemory
1052973abczzAncient Books (IOI17_books)C++17
0 / 100
1 ms348 KiB
#include "books.h" #include <iostream> #define ll long long using namespace std; long long minimum_walk(std::vector<int> p, int s) { ll n = p.size(), f = 0, mx = 0; for (int i=0; i<n; ++i) { f += abs(i-p[i]); } for (int i=0; i<n; ++i) { mx = max(mx, (ll)p[i]); if (mx == i) f += 2; } f -= 2; return f; }
#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...