Submission #60635

#TimeUsernameProblemLanguageResultExecution timeMemory
60635theknife2001Tropical Garden (IOI11_garden)C++17
Compilation error
0 ms0 KiB
#include "garden.h" #include "gardenlib.h" #include <bits/stdc++.h> using namespace std; const int N=1005; vector < pair < int , int > > vec[N]; int dfs(int u , int p , int k) { if(!k) return u; int v,c; int mv=p,mc=0; for(auto x:vec[u]) { v=x.first; c=x.second; if(v==p) continue; if(c>mc) { mc=c; mv=v; } } return dfs(mv,u,k-1); } void count_routes(int n, int m, int P, int r[][2], int Q, int G[]) { int k=G[0]; for(int i=0;i<m;i++) { vec[r[i][0]].push_back(r[i][1],m-i); vec[r[i][1]].push_back(r[i][0],m-i); } int cnt=0; for(int i=0;i<n;i++) { if(dfs(i,-1,k)==P) cnt++; } return cnt; }

Compilation message (stderr)

garden.cpp: In function 'void count_routes(int, int, int, int (*)[2], int, int*)':
garden.cpp:36:43: error: no matching function for call to 'std::vector<std::pair<int, int> >::push_back(int&, int)'
         vec[r[i][0]].push_back(r[i][1],m-i);
                                           ^
In file included from /usr/include/c++/7/vector:64:0,
                 from /usr/include/c++/7/functional:61,
                 from /usr/include/x86_64-linux-gnu/c++/7/bits/stdc++.h:71,
                 from garden.cpp:3:
/usr/include/c++/7/bits/stl_vector.h:939:7: note: candidate: void std::vector<_Tp, _Alloc>::push_back(const value_type&) [with _Tp = std::pair<int, int>; _Alloc = std::allocator<std::pair<int, int> >; std::vector<_Tp, _Alloc>::value_type = std::pair<int, int>]
       push_back(const value_type& __x)
       ^~~~~~~~~
/usr/include/c++/7/bits/stl_vector.h:939:7: note:   candidate expects 1 argument, 2 provided
/usr/include/c++/7/bits/stl_vector.h:953:7: note: candidate: void std::vector<_Tp, _Alloc>::push_back(std::vector<_Tp, _Alloc>::value_type&&) [with _Tp = std::pair<int, int>; _Alloc = std::allocator<std::pair<int, int> >; std::vector<_Tp, _Alloc>::value_type = std::pair<int, int>]
       push_back(value_type&& __x)
       ^~~~~~~~~
/usr/include/c++/7/bits/stl_vector.h:953:7: note:   candidate expects 1 argument, 2 provided
garden.cpp:37:43: error: no matching function for call to 'std::vector<std::pair<int, int> >::push_back(int&, int)'
         vec[r[i][1]].push_back(r[i][0],m-i);
                                           ^
In file included from /usr/include/c++/7/vector:64:0,
                 from /usr/include/c++/7/functional:61,
                 from /usr/include/x86_64-linux-gnu/c++/7/bits/stdc++.h:71,
                 from garden.cpp:3:
/usr/include/c++/7/bits/stl_vector.h:939:7: note: candidate: void std::vector<_Tp, _Alloc>::push_back(const value_type&) [with _Tp = std::pair<int, int>; _Alloc = std::allocator<std::pair<int, int> >; std::vector<_Tp, _Alloc>::value_type = std::pair<int, int>]
       push_back(const value_type& __x)
       ^~~~~~~~~
/usr/include/c++/7/bits/stl_vector.h:939:7: note:   candidate expects 1 argument, 2 provided
/usr/include/c++/7/bits/stl_vector.h:953:7: note: candidate: void std::vector<_Tp, _Alloc>::push_back(std::vector<_Tp, _Alloc>::value_type&&) [with _Tp = std::pair<int, int>; _Alloc = std::allocator<std::pair<int, int> >; std::vector<_Tp, _Alloc>::value_type = std::pair<int, int>]
       push_back(value_type&& __x)
       ^~~~~~~~~
/usr/include/c++/7/bits/stl_vector.h:953:7: note:   candidate expects 1 argument, 2 provided
garden.cpp:45:12: error: return-statement with a value, in function returning 'void' [-fpermissive]
     return cnt;
            ^~~