Submission #404966

#TimeUsernameProblemLanguageResultExecution timeMemory
404966LastRoninSwapping Cities (APIO20_swap)C++14
Compilation error
0 ms0 KiB
#include <bits/stdc++.h> #define pb push_back #define ll long long #define ull unsigned long long #define mp make_pair #define si short int #define speed ios_base::sync_with_stdio(0),cin.tie(0),cout.tie(0) #define pill pair<ll,ll> #define f first #define s second #define pilc pair<ll,char> #define all(a) (a).begin(),(a).end() #define rep(s,e,step) for(int i = (s); i < (e) ; i += step) #define vrep(s,e,step) for(int j = (s); j < (e) ; j += step) #define ex exit(0) #define sz(a) (ll)(a).size() #define triple pair<pill, ll> #define pinode pair<node*, node*> #define quadra pair<pill, pill> #define ld long double using namespace std; const ll N = 1e6 + 10; const ll M = 1e14; const ll big = 1e14; const ll hsh2 = 1964325029 ; const long long mod = 1e9 + 7; const long double EPS = 1e-20; const ll block = 500; const ll shift = 2e3; const ld pi = acos(-1.0); vector<ll> g[N], ng[N]; ll p[N], sz[N]; ll fnd(ll a) { return p[a] = (p[a] == a ? a : fnd(p[a])); } void unt(ll a, ll b, ll w) { a = fnd(a), b = fnd(b); if(a == b)return; g[a].pb(mp(b, w)); g[b].pb(mp(a, w)); if(sz[a] < sz[b]) swap(a, b); sz[a] += sz[b]: p[b] = a; } bool kek = 0; void init(ll n, ll m, vector<ll> u, vector<ll> v, vector<ll> w) { if(m == n - 1) { kek = 1; return; } vector<pair<ll, pill>> q; for(int i = 1; i <= m; i++) q.pb(mp(w[i - 1], mp(u[i - 1], v[i - 1]))); sort(all(q)); for(auto u : q) { ng[u.s.f].pb(mp(u.f, u.s.s)); unt(u.s.f, u.s.s, u.f); } dfs(1); } int getMinimumFuelCapacity(int X, int Y) { if(kek) { return -1; } return 0; } /* 4 4 6 1 9 2 5 3 2 */

Compilation message (stderr)

swap.cpp: In function 'void unt(long long int, long long int, long long int)':
swap.cpp:44:18: error: no matching function for call to 'std::vector<long long int>::push_back(std::pair<long long int, long long int>)'
   44 |  g[a].pb(mp(b, w));
      |                  ^
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:1:
/usr/include/c++/10/bits/stl_vector.h:1187:7: note: candidate: 'void std::vector<_Tp, _Alloc>::push_back(const value_type&) [with _Tp = long long int; _Alloc = std::allocator<long long int>; std::vector<_Tp, _Alloc>::value_type = long long int]'
 1187 |       push_back(const value_type& __x)
      |       ^~~~~~~~~
/usr/include/c++/10/bits/stl_vector.h:1187:35: note:   no known conversion for argument 1 from 'std::pair<long long int, long long int>' to 'const value_type&' {aka 'const long long int&'}
 1187 |       push_back(const value_type& __x)
      |                 ~~~~~~~~~~~~~~~~~~^~~
/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 = long long int; _Alloc = std::allocator<long long int>; std::vector<_Tp, _Alloc>::value_type = long long int]'
 1203 |       push_back(value_type&& __x)
      |       ^~~~~~~~~
/usr/include/c++/10/bits/stl_vector.h:1203:30: note:   no known conversion for argument 1 from 'std::pair<long long int, long long int>' to 'std::vector<long long int>::value_type&&' {aka 'long long int&&'}
 1203 |       push_back(value_type&& __x)
      |                 ~~~~~~~~~~~~~^~~
swap.cpp:45:18: error: no matching function for call to 'std::vector<long long int>::push_back(std::pair<long long int, long long int>)'
   45 |  g[b].pb(mp(a, w));
      |                  ^
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:1:
/usr/include/c++/10/bits/stl_vector.h:1187:7: note: candidate: 'void std::vector<_Tp, _Alloc>::push_back(const value_type&) [with _Tp = long long int; _Alloc = std::allocator<long long int>; std::vector<_Tp, _Alloc>::value_type = long long int]'
 1187 |       push_back(const value_type& __x)
      |       ^~~~~~~~~
/usr/include/c++/10/bits/stl_vector.h:1187:35: note:   no known conversion for argument 1 from 'std::pair<long long int, long long int>' to 'const value_type&' {aka 'const long long int&'}
 1187 |       push_back(const value_type& __x)
      |                 ~~~~~~~~~~~~~~~~~~^~~
/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 = long long int; _Alloc = std::allocator<long long int>; std::vector<_Tp, _Alloc>::value_type = long long int]'
 1203 |       push_back(value_type&& __x)
      |       ^~~~~~~~~
/usr/include/c++/10/bits/stl_vector.h:1203:30: note:   no known conversion for argument 1 from 'std::pair<long long int, long long int>' to 'std::vector<long long int>::value_type&&' {aka 'long long int&&'}
 1203 |       push_back(value_type&& __x)
      |                 ~~~~~~~~~~~~~^~~
swap.cpp:48:16: error: expected ';' before ':' token
   48 |  sz[a] += sz[b]:
      |                ^
      |                ;
swap.cpp: In function 'void init(long long int, long long int, std::vector<long long int>, std::vector<long long int>, std::vector<long long int>)':
swap.cpp:63:30: error: no matching function for call to 'std::vector<long long int>::push_back(std::pair<long long int, long long int>)'
   63 |   ng[u.s.f].pb(mp(u.f, u.s.s));
      |                              ^
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:1:
/usr/include/c++/10/bits/stl_vector.h:1187:7: note: candidate: 'void std::vector<_Tp, _Alloc>::push_back(const value_type&) [with _Tp = long long int; _Alloc = std::allocator<long long int>; std::vector<_Tp, _Alloc>::value_type = long long int]'
 1187 |       push_back(const value_type& __x)
      |       ^~~~~~~~~
/usr/include/c++/10/bits/stl_vector.h:1187:35: note:   no known conversion for argument 1 from 'std::pair<long long int, long long int>' to 'const value_type&' {aka 'const long long int&'}
 1187 |       push_back(const value_type& __x)
      |                 ~~~~~~~~~~~~~~~~~~^~~
/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 = long long int; _Alloc = std::allocator<long long int>; std::vector<_Tp, _Alloc>::value_type = long long int]'
 1203 |       push_back(value_type&& __x)
      |       ^~~~~~~~~
/usr/include/c++/10/bits/stl_vector.h:1203:30: note:   no known conversion for argument 1 from 'std::pair<long long int, long long int>' to 'std::vector<long long int>::value_type&&' {aka 'long long int&&'}
 1203 |       push_back(value_type&& __x)
      |                 ~~~~~~~~~~~~~^~~
swap.cpp:66:2: error: 'dfs' was not declared in this scope; did you mean 'ffs'?
   66 |  dfs(1);
      |  ^~~
      |  ffs