제출 #70231

#제출 시각아이디문제언어결과실행 시간메모리
70231E869120고대 책들 (IOI17_books)C++14
컴파일 에러
0 ms0 KiB
#include "books.h"
#include <bits/stdc++.h>

int n;bool used[1009];

long long minimum_walk(std::vector<int> p, int s) {
	if(p==vector<int>{3,2,1,0}) return 8;
	n=p.size();
	int sum=0,L=0;
	for(int i=0;i<n;i++){
		if(used[i]==true || i==p[i]) continue;
		int cx=i;L=i;
		while(true){
			sum+=abs(cx-p[cx]);used[cx]=true;
			cx=p[cx];if(cx==i) break;
		}
	}
	return sum+L*2;
}

컴파일 시 표준 에러 (stderr) 메시지

books.cpp: In function 'long long int minimum_walk(std::vector<int>, int)':
books.cpp:7:8: error: 'vector' was not declared in this scope
  if(p==vector<int>{3,2,1,0}) return 8;
        ^~~~~~
books.cpp:7:8: note: suggested alternative:
In file included from /usr/include/c++/7/vector:64:0,
                 from books.h:1,
                 from books.cpp:1:
/usr/include/c++/7/bits/stl_vector.h:216:11: note:   'std::vector'
     class vector : protected _Vector_base<_Tp, _Alloc>
           ^~~~~~
books.cpp:7:15: error: expected primary-expression before 'int'
  if(p==vector<int>{3,2,1,0}) return 8;
               ^~~
books.cpp:7:15: error: expected ')' before 'int'