Submission #701941

#TimeUsernameProblemLanguageResultExecution timeMemory
701941coding_snorlaxSwapping Cities (APIO20_swap)C++14
Compilation error
0 ms0 KiB
//#include "swap.h" #include <bits/stdc++.h> #define pb push_back #define mp make_pair using namespace std; vector<pair<int,int>> G[100002]; vector<int> process[100002]; vector<int> pass; int vis[100002]={0}; int N,Start,End; int dfs(int node){ vis[node]=1; pass.pb() for(int i:G[node]){ if(!vis[i]) dfs(i); } } int Check(int C){ for(int i=0;i<N;i++){ for(auto j:G[i]){ if(j.second<=C){ process[i].push_back(j.first); process[j.first].push_back(i); } } } } void init(int N, int M, vector<int> U, vector<int> V, vector<int> W) { N = num; for(int i=0;i<M;i++){ G[U[i]].pb(mp(V[i],W[i])); G[V[i]].pb(mp(U[i],W[i])); } } int getMinimumFuelCapacity(int X, int Y) { return 0; }

Compilation message (stderr)

swap.cpp: In function 'int dfs(int)':
swap.cpp:14:13: error: no matching function for call to 'std::vector<int>::push_back()'
   14 |     pass.pb()
      |             ^
In file included from /usr/include/c++/10/vector:67,
                 from /usr/include/c++/10/queue:61,
                 from /usr/include/x86_64-linux-gnu/c++/10/bits/stdc++.h:86,
                 from swap.cpp:3:
/usr/include/c++/10/bits/stl_vector.h:1187:7: note: candidate: 'void std::vector<_Tp, _Alloc>::push_back(const value_type&) [with _Tp = int; _Alloc = std::allocator<int>; std::vector<_Tp, _Alloc>::value_type = int]'
 1187 |       push_back(const value_type& __x)
      |       ^~~~~~~~~
/usr/include/c++/10/bits/stl_vector.h:1187:7: note:   candidate expects 1 argument, 0 provided
/usr/include/c++/10/bits/stl_vector.h:1203:7: note: candidate: 'void std::vector<_Tp, _Alloc>::push_back(std::vector<_Tp, _Alloc>::value_type&&) [with _Tp = int; _Alloc = std::allocator<int>; std::vector<_Tp, _Alloc>::value_type = int]'
 1203 |       push_back(value_type&& __x)
      |       ^~~~~~~~~
/usr/include/c++/10/bits/stl_vector.h:1203:7: note:   candidate expects 1 argument, 0 provided
swap.cpp:18:1: warning: no return statement in function returning non-void [-Wreturn-type]
   18 | }
      | ^
swap.cpp: In function 'int Check(int)':
swap.cpp:28:1: warning: no return statement in function returning non-void [-Wreturn-type]
   28 | }
      | ^
swap.cpp: In function 'void init(int, int, std::vector<int>, std::vector<int>, std::vector<int>)':
swap.cpp:30:9: error: 'num' was not declared in this scope; did you mean 'enum'?
   30 |     N = num;
      |         ^~~
      |         enum