Submission #577476

#TimeUsernameProblemLanguageResultExecution timeMemory
577476definitelynotmeeAncient Books (IOI17_books)C++98
12 / 100
1 ms300 KiB
#include<bits/stdc++.h> #include "books.h" using namespace std; #define ff first #define ss second #define all(x) x.begin(), x.end() using ll = long long; using pii = pair<int,int>; using pll = pair<ll,ll>; template<typename T> using matrix = vector<vector<T>>; long long minimum_walk(std::vector<int> p, int s) { int mindif = -1; int n = p.size(); for(int i = 0; i < n; i++){ if(p[i]!=i){ mindif = i; break; } } if(mindif == -1) return 0; ll resp = 2*mindif; for(int i = 0; i < n; i++){ resp+=abs(i-p[i]); } return resp; }
#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...