제출 #1042199

#제출 시각아이디문제언어결과실행 시간메모리
1042199raphaelp고대 책들 (IOI17_books)C++17
컴파일 에러
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; }

컴파일 시 표준 에러 (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);
      |                 ^