Submission #66330

#TimeUsernameProblemLanguageResultExecution timeMemory
66330FedericoSAncient Books (IOI17_books)C++14
0 / 100
3 ms376 KiB
#include <iostream> #include <algorithm> #include "books.h" using namespace std; typedef long long int ll; typedef pair<ll,ll> pll; int N,S; ll P[1000006]; ll ans; long long minimum_walk(std::vector<int> q, int s) { N=q.size(); S=s; for(ll i=0;i<N;i++){ P[i]=q[i]; ans+=abs(P[i]-i); } for(ll i=0;P[i]!=i;i++) ans+=2; for(ll i=N-1;P[i]!=i;i--) ans-=2; return ans; }
#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...