제출 #657655

#제출 시각아이디문제언어결과실행 시간메모리
657655activedeltorre밀림 점프 (APIO21_jumps)C++14
컴파일 에러
0 ms0 KiB
#include "jumps.h" #include <vector> void init(int N, std::vector<int> H) { n=N; vector<int>vec=H; /* for(i=1;i<=n;i++) { }*/ } int minimum_jumps(int a, int b, int c, int d) { if(a>d) { return -1; } else { return max(0,c-b); } }

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

jumps.cpp: In function 'void init(int, std::vector<int>)':
jumps.cpp:7:5: error: 'n' was not declared in this scope
    7 |     n=N;
      |     ^
jumps.cpp:8:5: error: 'vector' was not declared in this scope; did you mean 'std::vector'?
    8 |     vector<int>vec=H;
      |     ^~~~~~
      |     std::vector
In file included from /usr/include/c++/10/vector:67,
                 from jumps.h:1,
                 from jumps.cpp:1:
/usr/include/c++/10/bits/stl_vector.h:389:11: note: 'std::vector' declared here
  389 |     class vector : protected _Vector_base<_Tp, _Alloc>
      |           ^~~~~~
jumps.cpp:8:12: error: expected primary-expression before 'int'
    8 |     vector<int>vec=H;
      |            ^~~
jumps.cpp: In function 'int minimum_jumps(int, int, int, int)':
jumps.cpp:23:16: error: 'max' was not declared in this scope; did you mean 'std::max'?
   23 |         return max(0,c-b);
      |                ^~~
      |                std::max
In file included from /usr/include/c++/10/vector:60,
                 from jumps.h:1,
                 from jumps.cpp:1:
/usr/include/c++/10/bits/stl_algobase.h:300:5: note: 'std::max' declared here
  300 |     max(const _Tp& __a, const _Tp& __b, _Compare __comp)
      |     ^~~