Submission #398857

#TimeUsernameProblemLanguageResultExecution timeMemory
398857almothana05Cop and Robber (BOI14_coprobber)C++14
Compilation error
0 ms0 KiB
#include "coprobber.h" #include<iostream> #include<vector> using namespace std; int menge = 0 , jet = 0; vector<vector<bool> >num; int start(int N, bool A[MAX_N][MAX_N]) { for(int i = 0 ;i < N ; i++){ num.push_back(vector<int>()); for(int j = 0 ; j < N ; j++){ num[i].push_back(A[i][j]); } } menge = N; return 0; } int nextMove(int R) { if(num[jet][R] == 1){ return R; } else{ return jet; } }

Compilation message (stderr)

coprobber.cpp: In function 'int start(int, bool (*)[500])':
coprobber.cpp:10:30: error: no matching function for call to 'std::vector<std::vector<bool> >::push_back(std::vector<int>)'
   10 |   num.push_back(vector<int>());
      |                              ^
In file included from /usr/include/c++/9/vector:67,
                 from coprobber.cpp:3:
/usr/include/c++/9/bits/stl_vector.h:1184:7: note: candidate: 'void std::vector<_Tp, _Alloc>::push_back(const value_type&) [with _Tp = std::vector<bool>; _Alloc = std::allocator<std::vector<bool> >; std::vector<_Tp, _Alloc>::value_type = std::vector<bool>]'
 1184 |       push_back(const value_type& __x)
      |       ^~~~~~~~~
/usr/include/c++/9/bits/stl_vector.h:1184:35: note:   no known conversion for argument 1 from 'std::vector<int>' to 'const value_type&' {aka 'const std::vector<bool>&'}
 1184 |       push_back(const value_type& __x)
      |                 ~~~~~~~~~~~~~~~~~~^~~
/usr/include/c++/9/bits/stl_vector.h:1200:7: note: candidate: 'void std::vector<_Tp, _Alloc>::push_back(std::vector<_Tp, _Alloc>::value_type&&) [with _Tp = std::vector<bool>; _Alloc = std::allocator<std::vector<bool> >; std::vector<_Tp, _Alloc>::value_type = std::vector<bool>]'
 1200 |       push_back(value_type&& __x)
      |       ^~~~~~~~~
/usr/include/c++/9/bits/stl_vector.h:1200:30: note:   no known conversion for argument 1 from 'std::vector<int>' to 'std::vector<std::vector<bool> >::value_type&&' {aka 'std::vector<bool>&&'}
 1200 |       push_back(value_type&& __x)
      |                 ~~~~~~~~~~~~~^~~