제출 #770138

#제출 시각아이디문제언어결과실행 시간메모리
770138APROHACK고대 책들 (IOI17_books)C++14
컴파일 에러
0 ms0 KiB
#include "books.h" #include <bits/stdc++.h> #define ll long long #define ff first #define ss second #define pb push_back using namespace std; int n; int startTo[1000000]; int searchR(int pos){ for(int i = pos ; i < n ; i ++){ if(startTo[i] != -1)return i; } return -1; } ll searchL(ll pos){ for(int i = 0 ; i < n; i ++){ if(startTo[i] != -1)return i; } return -1; } ll pos = 0, temp; ll ans = 0; void ir(ll siguiente){ ans += abs(siguiente-pos); pos = siguiente; } long long minimum_walk(std::vector<> p, int s) { n = p.size();int for(int i = 0 ; i < n ; i ++){ startTo[i] = -1; if(p[i] > i){ startTo[i] = p[i]; } } while(true){ ll nextL = searchL(pos); if(nextL != -1){ ir(nextL); temp = pos; ir(startTo[pos]); startTo[temp] = -1; continue; } ans+= pos; return ans; } }

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

books.cpp:30:36: error: wrong number of template arguments (0, should be at least 1)
   30 | long long minimum_walk(std::vector<> p, int s) {
      |                                    ^
In file included from /usr/include/c++/10/vector:67,
                 from books.h:1,
                 from books.cpp:1:
/usr/include/c++/10/bits/stl_vector.h:389:11: note: provided for 'template<class _Tp, class _Alloc> class std::vector'
  389 |     class vector : protected _Vector_base<_Tp, _Alloc>
      |           ^~~~~~
books.cpp: In function 'long long int minimum_walk(int, int)':
books.cpp:31:8: error: request for member 'size' in 'p', which is of non-class type 'int'
   31 |  n = p.size();int
      |        ^~~~
books.cpp:32:2: error: expected unqualified-id before 'for'
   32 |  for(int i = 0 ; i < n ; i ++){
      |  ^~~
books.cpp:32:18: error: 'i' was not declared in this scope
   32 |  for(int i = 0 ; i < n ; i ++){
      |                  ^