Submission #1042199

#TimeUsernameProblemLanguageResultExecution timeMemory
1042199raphaelpAncient Books (IOI17_books)C++17
Compilation error
0 ms0 KiB
#include<bits/stdc++.h> using namespace std; long long minimum_walk(vector<int> p, int s) { int N=p.size(); long long ans=0; for (int i=0; i<N; i++) { ans+=abs(i-p[i]); } vector<int>occ(N); for(int i=0; i<N; i++) { if(occ[i])continue; int x=i; ans+=2; while(!occ[x]) { occ[x]=1; x=p[x]; } return ans-2; }

Compilation message (stderr)

books.cpp: In function 'long long int minimum_walk(std::vector<int>, int)':
books.cpp:23:1: error: expected '}' at end of input
   23 | }
      | ^
books.cpp:4:1: note: to match this '{'
    4 | {
      | ^
books.cpp:11:17: warning: control reaches end of non-void function [-Wreturn-type]
   11 | vector<int>occ(N);
      |                 ^