Submission #487243

#TimeUsernameProblemLanguageResultExecution timeMemory
487243ala2Rainforest Jumps (APIO21_jumps)C++14
Compilation error
0 ms0 KiB
#include "jumps.h" #include <vector> #define int long long #include <queue> using namespace std; int n; vector<int>h; vector<int>v[1000100]; int vi[1100][1100]; int d[1000][1000]; int g[1000100]; queue<int>q; int mn=1000000023; void bfs(int node) { vi[node][node]=1; q.push(0); while(!q.empty()){ int u=q.front(); q.pop();// cout<<" "<<u<<endl; d[node][node]=0; for(int i=0;i<v[u].size();i++) { if(!vi[node][v[u][i]]){ q.push(v[u][i]); d[node][v[u][i]]=d[node][u]+1; vi[node][v[u][i]]=1; } } } } void init(int N, vector<int> H) { n=N; for(int i=0;i<n;i++) { h.push_back(H[i]); } for(int i=0;i<n;i++) { for(int j=i-1;j>=0;j--) { if(h[j]>h[i]) { v[i].push_back(j); d[i][j]=1; break; } } for(int j=i+1;j<n;j++) { if(h[j]>h[i]) { v[i].push_back(j); d[i][j]=1; break; } } } for(int i=0;i<n;i++) bfs(i); } int minimum_jumps(int A, int B, int C, int D) { mn=1000000003; //cout<<" "<<d[3][6]<<endl; for(int i=A;i<=B;i++) { for(int j=C;j<=D;j++) { if(d[i][j]) mn=min(mn,d[i][j]); } } if(mn==1000000003) return -1; return mn; // return 0; }

Compilation message (stderr)

/usr/include/c++/10/bits/stl_function.h: In member function 'constexpr bool std::greater<_Tp*>::operator()(_Tp*, _Tp*) const':
jumps.cpp:4:22: error: 'long long long' is too long for GCC
    4 |     #define int long long
      |                      ^~~~
jumps.cpp:4:22: error: 'long long long' is too long for GCC
    4 |     #define int long long
      |                      ^~~~
/usr/include/c++/10/bits/stl_function.h: In member function 'constexpr bool std::less<_Tp*>::operator()(_Tp*, _Tp*) const':
jumps.cpp:4:22: error: 'long long long' is too long for GCC
    4 |     #define int long long
      |                      ^~~~
jumps.cpp:4:22: error: 'long long long' is too long for GCC
    4 |     #define int long long
      |                      ^~~~
/usr/include/c++/10/bits/stl_function.h: In member function 'constexpr bool std::greater_equal<_Tp*>::operator()(_Tp*, _Tp*) const':
jumps.cpp:4:22: error: 'long long long' is too long for GCC
    4 |     #define int long long
      |                      ^~~~
jumps.cpp:4:22: error: 'long long long' is too long for GCC
    4 |     #define int long long
      |                      ^~~~
/usr/include/c++/10/bits/stl_function.h: In member function 'constexpr bool std::less_equal<_Tp*>::operator()(_Tp*, _Tp*) const':
jumps.cpp:4:22: error: 'long long long' is too long for GCC
    4 |     #define int long long
      |                      ^~~~
jumps.cpp:4:22: error: 'long long long' is too long for GCC
    4 |     #define int long long
      |                      ^~~~
In file included from /usr/include/c++/10/deque:67,
                 from /usr/include/c++/10/queue:60,
                 from jumps.cpp:5:
/usr/include/c++/10/bits/stl_deque.h: In instantiation of 'struct std::_Deque_iterator<long long int, long long int&, long long int*>':
/usr/include/c++/10/bits/stl_deque.h:483:47:   required from 'class std::_Deque_base<long long int, std::allocator<long long int> >'
/usr/include/c++/10/bits/stl_deque.h:764:11:   required from 'class std::deque<long long int, std::allocator<long long int> >'
/usr/include/c++/10/bits/stl_queue.h:138:47:   required from 'class std::queue<long long int>'
jumps.cpp:9:16:   required from here
/usr/include/c++/10/bits/stl_deque.h:200:7: error: postfix 'std::_Deque_iterator<_Tp, _Ref, _Ptr>::_Self std::_Deque_iterator<_Tp, _Ref, _Ptr>::operator++(long long int) [with _Tp = long long int; _Ref = long long int&; _Ptr = long long int*; std::_Deque_iterator<_Tp, _Ref, _Ptr>::_Self = std::_Deque_iterator<long long int, long long int&, long long int*>::_Self]' must have 'int' as its argument
  200 |       operator++(int) _GLIBCXX_NOEXCEPT
      |       ^~~~~~~~
/usr/include/c++/10/bits/stl_deque.h:220:7: error: postfix 'std::_Deque_iterator<_Tp, _Ref, _Ptr>::_Self std::_Deque_iterator<_Tp, _Ref, _Ptr>::operator--(long long int) [with _Tp = long long int; _Ref = long long int&; _Ptr = long long int*; std::_Deque_iterator<_Tp, _Ref, _Ptr>::_Self = std::_Deque_iterator<long long int, long long int&, long long int*>::_Self]' must have 'int' as its argument
  220 |       operator--(int) _GLIBCXX_NOEXCEPT
      |       ^~~~~~~~
jumps.cpp: In function 'void bfs(long long int)':
jumps.cpp:18:23: warning: comparison of integer expressions of different signedness: 'long long int' and 'std::vector<long long int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   18 |          for(int i=0;i<v[u].size();i++)
      |                      ~^~~~~~~~~~~~