Submission #657656

# Submission time Handle Problem Language Result Execution time Memory
657656 2022-11-10T15:36:49 Z activedeltorre Rainforest Jumps (APIO21_jumps) C++14
Compilation error
0 ms 0 KB
//#include "jumps.h"

#include <vector>

void init(int N, std::vector<int> H)
{
    int n=N;
    vector<int>vec;
    swap(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);
    }
}

Compilation message

jumps.cpp: In function 'void init(int, std::vector<int>)':
jumps.cpp:8:5: error: 'vector' was not declared in this scope; did you mean 'std::vector'?
    8 |     vector<int>vec;
      |     ^~~~~~
      |     std::vector
In file included from /usr/include/c++/10/vector:67,
                 from jumps.cpp:3:
/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;
      |            ^~~
jumps.cpp:9:10: error: 'vec' was not declared in this scope
    9 |     swap(vec,H);
      |          ^~~
jumps.cpp:7:9: warning: unused variable 'n' [-Wunused-variable]
    7 |     int n=N;
      |         ^
jumps.cpp: In function 'int minimum_jumps(int, int, int, int)':
jumps.cpp:24:16: error: 'max' was not declared in this scope; did you mean 'std::max'?
   24 |         return max(0,c-b);
      |                ^~~
      |                std::max
In file included from /usr/include/c++/10/vector:60,
                 from jumps.cpp:3:
/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)
      |     ^~~