# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
786907 | 2023-07-18T14:33:02 Z | jamkel | Two Transportations (JOI19_transportations) | C++14 | Compilation error |
0 ms | 0 KB |
#include <bits/stdc++.h> #include "Azer.h" using namespace std; #define st first #define nd second typedef long long ll; int odl=0,nu=0; int k1=0,k2=0; int n; vector<int>w(2000,-1); priority_queue<pair<int,int>,vector<pair<int,int>>,greater<pair<int,int>>>q; vector<vector<pair<int,int>>>g(); int ile=1; vector<int>Answer() { vector<int>v(n); for(int i=0;i<n;i++) { v[i]=w[i]; } return v; } void InitA(int N, int A, std::vector<int> U, std::vector<int> V, std::vector<int> C) { n=N; w[0]=0; for(int i=0;i<n;i++) { g.push_back({}); } for(int i=0;i<A;i++) { g[U[i]].push_back({C[i],V[i]}); g[V[i]].push_back({C[i],U[i]}); } for(long unsigned int i=0;i<g[0].size();i++) { q.push({g[0][i].st,g[0][i].nd}); } q.push({1048575,0}); for(int i=0;i<20;i++) { SendA(q.top().st&(1<<i)); } for(int i=0;i<11;i++) { SendA(q.top().nd&(1<<i)); } } void ReceiveA(bool x) { if(k1<20) { if(x) { odl+=pow(2,k1); } k1++; } else { if(x) { nu+=pow(2,k2); } k2++; } if(k2==11) { w[nu]=odl; ile++; for(long unsigned int i=0;i<g[nu].size();i++) { q.push({g[nu][i].st+odl,g[nu][i].nd}); } while(w[q.top().nd]>-1 && q.top().nd!=0) { q.pop(); } if(ile<n) { for(int i=0;i<20;i++) { SendA(q.top().st&(1<<i)); } for(int i=0;i<11;i++) { SendA(q.top().nd&(1<<i)); } } k1=0;k2=0;odl=0;nu=0; } }
#include <bits/stdc++.h> #include "Baijan.h" using namespace std; #define st first #define nd second typedef long long ll; int odl=0,nu=0; int k1=0,k2=0; int n; vector<int>w(2000,-1); priority_queue<pair<int,int>,vector<pair<int,int>>,greater<pair<int,int>>>q; vector<vector<pair<int,int>>>g(); void InitB(int N, int B, std::vector<int> S, std::vector<int> T, std::vector<int> D) { w[0]=0; for(int i=0;i<n;i++) { g.push_back({}); } for(int i=0;i<B;i++) { g[S[i]].push_back({D[i],T[i]}); g[T[i]].push_back({D[i],S[i]}); } for(long unsigned int i=0;i<g[0].size();i++) { q.push({g[0][i].st,g[0][i].nd}); } q.push({1048575,0}); } void ReceiveB(bool x) { if(k1<20) { if(x) { odl+=pow(2,k1); } k1++; } else { if(x) { nu+=pow(2,k2); } k2++; } if(k2==11) { if(odl>=q.top().st) { odl=q.top().st; nu=q.top().nd; } w[nu]=odl; for(long unsigned int i=0;i<g[nu].size();i++) { q.push({g[nu][i].st+odl,g[nu][i].nd}); } for(int i=0;i<20;i++) { SendB(odl&(1<<i)); } for(int i=0;i<11;i++) { SendB(nu&(1<<i)); } k1=0;k2=0;odl=0;nu=0; } }
Compilation message
Azer.cpp: In function 'void InitA(int, int, std::vector<int>, std::vector<int>, std::vector<int>)': Azer.cpp:29:11: error: request for member 'push_back' in 'g', which is of non-class type 'std::vector<std::vector<std::pair<int, int> > >()' 29 | g.push_back({}); | ^~~~~~~~~ Azer.cpp:33:15: warning: pointer to a function used in arithmetic [-Wpointer-arith] 33 | g[U[i]].push_back({C[i],V[i]}); | ^ Azer.cpp:33:17: error: request for member 'push_back' in '*(g + ((sizetype)U.std::vector<int>::operator[](((std::vector<int>::size_type)i))))', which is of non-class type 'std::vector<std::vector<std::pair<int, int> > >()' 33 | g[U[i]].push_back({C[i],V[i]}); | ^~~~~~~~~ Azer.cpp:34:15: warning: pointer to a function used in arithmetic [-Wpointer-arith] 34 | g[V[i]].push_back({C[i],U[i]}); | ^ Azer.cpp:34:17: error: request for member 'push_back' in '*(g + ((sizetype)V.std::vector<int>::operator[](((std::vector<int>::size_type)i))))', which is of non-class type 'std::vector<std::vector<std::pair<int, int> > >()' 34 | g[V[i]].push_back({C[i],U[i]}); | ^~~~~~~~~ Azer.cpp:36:36: warning: pointer to a function used in arithmetic [-Wpointer-arith] 36 | for(long unsigned int i=0;i<g[0].size();i++) | ^ Azer.cpp:36:38: error: request for member 'size' in '* g', which is of non-class type 'std::vector<std::vector<std::pair<int, int> > >()' 36 | for(long unsigned int i=0;i<g[0].size();i++) | ^~~~ Azer.cpp:38:20: warning: pointer to a function used in arithmetic [-Wpointer-arith] 38 | q.push({g[0][i].st,g[0][i].nd}); | ^ Azer.cpp:38:23: warning: pointer to a function used in arithmetic [-Wpointer-arith] 38 | q.push({g[0][i].st,g[0][i].nd}); | ^ Azer.cpp:4:12: error: request for member 'first' in '*(g + ((sizetype)i))', which is of non-class type 'std::vector<std::vector<std::pair<int, int> > >()' 4 | #define st first | ^~~~~ Azer.cpp:38:25: note: in expansion of macro 'st' 38 | q.push({g[0][i].st,g[0][i].nd}); | ^~ Azer.cpp:38:31: warning: pointer to a function used in arithmetic [-Wpointer-arith] 38 | q.push({g[0][i].st,g[0][i].nd}); | ^ Azer.cpp:38:34: warning: pointer to a function used in arithmetic [-Wpointer-arith] 38 | q.push({g[0][i].st,g[0][i].nd}); | ^ Azer.cpp:5:12: error: request for member 'second' in '*(g + ((sizetype)i))', which is of non-class type 'std::vector<std::vector<std::pair<int, int> > >()' 5 | #define nd second | ^~~~~~ Azer.cpp:38:36: note: in expansion of macro 'nd' 38 | q.push({g[0][i].st,g[0][i].nd}); | ^~ Azer.cpp:38:39: error: no matching function for call to 'std::priority_queue<std::pair<int, int>, std::vector<std::pair<int, int> >, std::greater<std::pair<int, int> > >::push(<brace-enclosed initializer list>)' 38 | q.push({g[0][i].st,g[0][i].nd}); | ^ In file included from /usr/include/c++/10/queue:64, from /usr/include/x86_64-linux-gnu/c++/10/bits/stdc++.h:86, from Azer.cpp:1: /usr/include/c++/10/bits/stl_queue.h:640:7: note: candidate: 'void std::priority_queue<_Tp, _Sequence, _Compare>::push(const value_type&) [with _Tp = std::pair<int, int>; _Sequence = std::vector<std::pair<int, int> >; _Compare = std::greater<std::pair<int, int> >; std::priority_queue<_Tp, _Sequence, _Compare>::value_type = std::pair<int, int>]' 640 | push(const value_type& __x) | ^~~~ /usr/include/c++/10/bits/stl_queue.h:640:30: note: no known conversion for argument 1 from '<brace-enclosed initializer list>' to 'const value_type&' {aka 'const std::pair<int, int>&'} 640 | push(const value_type& __x) | ~~~~~~~~~~~~~~~~~~^~~ /usr/include/c++/10/bits/stl_queue.h:648:7: note: candidate: 'void std::priority_queue<_Tp, _Sequence, _Compare>::push(std::priority_queue<_Tp, _Sequence, _Compare>::value_type&&) [with _Tp = std::pair<int, int>; _Sequence = std::vector<std::pair<int, int> >; _Compare = std::greater<std::pair<int, int> >; std::priority_queue<_Tp, _Sequence, _Compare>::value_type = std::pair<int, int>]' 648 | push(value_type&& __x) | ^~~~ /usr/include/c++/10/bits/stl_queue.h:648:25: note: no known conversion for argument 1 from '<brace-enclosed initializer list>' to 'std::priority_queue<std::pair<int, int>, std::vector<std::pair<int, int> >, std::greater<std::pair<int, int> > >::value_type&&' {aka 'std::pair<int, int>&&'} 648 | push(value_type&& __x) | ~~~~~~~~~~~~~^~~ Azer.cpp: In function 'void ReceiveA(bool)': Azer.cpp:72:45: warning: pointer to a function used in arithmetic [-Wpointer-arith] 72 | for(long unsigned int i=0;i<g[nu].size();i++) | ^ Azer.cpp:72:47: error: request for member 'size' in '*(g + ((sizetype)nu))', which is of non-class type 'std::vector<std::vector<std::pair<int, int> > >()' 72 | for(long unsigned int i=0;i<g[nu].size();i++) | ^~~~ Azer.cpp:74:29: warning: pointer to a function used in arithmetic [-Wpointer-arith] 74 | q.push({g[nu][i].st+odl,g[nu][i].nd}); | ^ Azer.cpp:74:32: warning: pointer to a function used in arithmetic [-Wpointer-arith] 74 | q.push({g[nu][i].st+odl,g[nu][i].nd}); | ^ Azer.cpp:4:12: error: request for member 'first' in '*(g + (((sizetype)nu) + ((sizetype)i)))', which is of non-class type 'std::vector<std::vector<std::pair<int, int> > >()' 4 | #define st first | ^~~~~ Azer.cpp:74:34: note: in expansion of macro 'st' 74 | q.push({g[nu][i].st+odl,g[nu][i].nd}); | ^~ Azer.cpp:74:45: warning: pointer to a function used in arithmetic [-Wpointer-arith] 74 | q.push({g[nu][i].st+odl,g[nu][i].nd}); | ^ Azer.cpp:74:48: warning: pointer to a function used in arithmetic [-Wpointer-arith] 74 | q.push({g[nu][i].st+odl,g[nu][i].nd}); | ^ Azer.cpp:5:12: error: request for member 'second' in '*(g + (((sizetype)nu) + ((sizetype)i)))', which is of non-class type 'std::vector<std::vector<std::pair<int, int> > >()' 5 | #define nd second | ^~~~~~ Azer.cpp:74:50: note: in expansion of macro 'nd' 74 | q.push({g[nu][i].st+odl,g[nu][i].nd}); | ^~ Azer.cpp:74:53: error: no matching function for call to 'std::priority_queue<std::pair<int, int>, std::vector<std::pair<int, int> >, std::greater<std::pair<int, int> > >::push(<brace-enclosed initializer list>)' 74 | q.push({g[nu][i].st+odl,g[nu][i].nd}); | ^ In file included from /usr/include/c++/10/queue:64, from /usr/include/x86_64-linux-gnu/c++/10/bits/stdc++.h:86, from Azer.cpp:1: /usr/include/c++/10/bits/stl_queue.h:640:7: note: candidate: 'void std::priority_queue<_Tp, _Sequence, _Compare>::push(const value_type&) [with _Tp = std::pair<int, int>; _Sequence = std::vector<std::pair<int, int> >; _Compare = std::greater<std::pair<int, int> >; std::priority_queue<_Tp, _Sequence, _Compare>::value_type = std::pair<int, int>]' 640 | push(const value_type& __x) | ^~~~ /usr/include/c++/10/bits/stl_queue.h:640:30: note: no known conversion for argument 1 from '<brace-enclosed initializer list>' to 'const value_type&' {aka 'const std::pair<int, int>&'} 640 | push(const value_type& __x) | ~~~~~~~~~~~~~~~~~~^~~ /usr/include/c++/10/bits/stl_queue.h:648:7: note: candidate: 'void std::priority_queue<_Tp, _Sequence, _Compare>::push(std::priority_queue<_Tp, _Sequence, _Compare>::value_type&&) [with _Tp = std::pair<int, int>; _Sequence = std::vector<std::pair<int, int> >; _Compare = std::greater<std::pair<int, int> >; std::priority_queue<_Tp, _Sequence, _Compare>::value_type = std::pair<int, int>]' 648 | push(value_type&& __x) | ^~~~ /usr/include/c++/10/bits/stl_queue.h:648:25: note: no known conversion for argument 1 from '<brace-enclosed initializer list>' to 'std::priority_queue<std::pair<int, int>, std::vector<std::pair<int, int> >, std::greater<std::pair<int, int> > >::value_type&&' {aka 'std::pair<int, int>&&'} 648 | push(value_type&& __x) | ~~~~~~~~~~~~~^~~ Baijan.cpp: In function 'void InitB(int, int, std::vector<int>, std::vector<int>, std::vector<int>)': Baijan.cpp:18:11: error: request for member 'push_back' in 'g', which is of non-class type 'std::vector<std::vector<std::pair<int, int> > >()' 18 | g.push_back({}); | ^~~~~~~~~ Baijan.cpp:22:15: warning: pointer to a function used in arithmetic [-Wpointer-arith] 22 | g[S[i]].push_back({D[i],T[i]}); | ^ Baijan.cpp:22:17: error: request for member 'push_back' in '*(g + ((sizetype)S.std::vector<int>::operator[](((std::vector<int>::size_type)i))))', which is of non-class type 'std::vector<std::vector<std::pair<int, int> > >()' 22 | g[S[i]].push_back({D[i],T[i]}); | ^~~~~~~~~ Baijan.cpp:23:15: warning: pointer to a function used in arithmetic [-Wpointer-arith] 23 | g[T[i]].push_back({D[i],S[i]}); | ^ Baijan.cpp:23:17: error: request for member 'push_back' in '*(g + ((sizetype)T.std::vector<int>::operator[](((std::vector<int>::size_type)i))))', which is of non-class type 'std::vector<std::vector<std::pair<int, int> > >()' 23 | g[T[i]].push_back({D[i],S[i]}); | ^~~~~~~~~ Baijan.cpp:25:36: warning: pointer to a function used in arithmetic [-Wpointer-arith] 25 | for(long unsigned int i=0;i<g[0].size();i++) | ^ Baijan.cpp:25:38: error: request for member 'size' in '* g', which is of non-class type 'std::vector<std::vector<std::pair<int, int> > >()' 25 | for(long unsigned int i=0;i<g[0].size();i++) | ^~~~ Baijan.cpp:27:20: warning: pointer to a function used in arithmetic [-Wpointer-arith] 27 | q.push({g[0][i].st,g[0][i].nd}); | ^ Baijan.cpp:27:23: warning: pointer to a function used in arithmetic [-Wpointer-arith] 27 | q.push({g[0][i].st,g[0][i].nd}); | ^ Baijan.cpp:4:12: error: request for member 'first' in '*(g + ((sizetype)i))', which is of non-class type 'std::vector<std::vector<std::pair<int, int> > >()' 4 | #define st first | ^~~~~ Baijan.cpp:27:25: note: in expansion of macro 'st' 27 | q.push({g[0][i].st,g[0][i].nd}); | ^~ Baijan.cpp:27:31: warning: pointer to a function used in arithmetic [-Wpointer-arith] 27 | q.push({g[0][i].st,g[0][i].nd}); | ^ Baijan.cpp:27:34: warning: pointer to a function used in arithmetic [-Wpointer-arith] 27 | q.push({g[0][i].st,g[0][i].nd}); | ^ Baijan.cpp:5:12: error: request for member 'second' in '*(g + ((sizetype)i))', which is of non-class type 'std::vector<std::vector<std::pair<int, int> > >()' 5 | #define nd second | ^~~~~~ Baijan.cpp:27:36: note: in expansion of macro 'nd' 27 | q.push({g[0][i].st,g[0][i].nd}); | ^~ Baijan.cpp:27:39: error: no matching function for call to 'std::priority_queue<std::pair<int, int>, std::vector<std::pair<int, int> >, std::greater<std::pair<int, int> > >::push(<brace-enclosed initializer list>)' 27 | q.push({g[0][i].st,g[0][i].nd}); | ^ In file included from /usr/include/c++/10/queue:64, from /usr/include/x86_64-linux-gnu/c++/10/bits/stdc++.h:86, from Baijan.cpp:1: /usr/include/c++/10/bits/stl_queue.h:640:7: note: candidate: 'void std::priority_queue<_Tp, _Sequence, _Compare>::push(const value_type&) [with _Tp = std::pair<int, int>; _Sequence = std::vector<std::pair<int, int> >; _Compare = std::greater<std::pair<int, int> >; std::priority_queue<_Tp, _Sequence, _Compare>::value_type = std::pair<int, int>]' 640 | push(const value_type& __x) | ^~~~ /usr/include/c++/10/bits/stl_queue.h:640:30: note: no known conversion for argument 1 from '<brace-enclosed initializer list>' to 'const value_type&' {aka 'const std::pair<int, int>&'} 640 | push(const value_type& __x) | ~~~~~~~~~~~~~~~~~~^~~ /usr/include/c++/10/bits/stl_queue.h:648:7: note: candidate: 'void std::priority_queue<_Tp, _Sequence, _Compare>::push(std::priority_queue<_Tp, _Sequence, _Compare>::value_type&&) [with _Tp = std::pair<int, int>; _Sequence = std::vector<std::pair<int, int> >; _Compare = std::greater<std::pair<int, int> >; std::priority_queue<_Tp, _Sequence, _Compare>::value_type = std::pair<int, int>]' 648 | push(value_type&& __x) | ^~~~ /usr/include/c++/10/bits/stl_queue.h:648:25: note: no known conversion for argument 1 from '<brace-enclosed initializer list>' to 'std::priority_queue<std::pair<int, int>, std::vector<std::pair<int, int> >, std::greater<std::pair<int, int> > >::value_type&&' {aka 'std::pair<int, int>&&'} 648 | push(value_type&& __x) | ~~~~~~~~~~~~~^~~ Baijan.cpp: In function 'void ReceiveB(bool)': Baijan.cpp:58:45: warning: pointer to a function used in arithmetic [-Wpointer-arith] 58 | for(long unsigned int i=0;i<g[nu].size();i++) | ^ Baijan.cpp:58:47: error: request for member 'size' in '*(g + ((sizetype)nu))', which is of non-class type 'std::vector<std::vector<std::pair<int, int> > >()' 58 | for(long unsigned int i=0;i<g[nu].size();i++) | ^~~~ Baijan.cpp:60:29: warning: pointer to a function used in arithmetic [-Wpointer-arith] 60 | q.push({g[nu][i].st+odl,g[nu][i].nd}); | ^ Baijan.cpp:60:32: warning: pointer to a function used in arithmetic [-Wpointer-arith] 60 | q.push({g[nu][i].st+odl,g[nu][i].nd}); | ^ Baijan.cpp:4:12: error: request for member 'first' in '*(g + (((sizetype)nu) + ((sizetype)i)))', which is of non-class type 'std::vector<std::vector<std::pair<int, int> > >()' 4 | #define st first | ^~~~~ Baijan.cpp:60:34: note: in expansion of macro 'st' 60 | q.push({g[nu][i].st+odl,g[nu][i].nd}); | ^~ Baijan.cpp:60:45: warning: pointer to a function used in arithmetic [-Wpointer-arith] 60 | q.push({g[nu][i].st+odl,g[nu][i].nd}); | ^ Baijan.cpp:60:48: warning: pointer to a function used in arithmetic [-Wpointer-arith] 60 | q.push({g[nu][i].st+odl,g[nu][i].nd}); | ^ Baijan.cpp:5:12: error: request for member 'second' in '*(g + (((sizetype)nu) + ((sizetype)i)))', which is of non-class type 'std::vector<std::vector<std::pair<int, int> > >()' 5 | #define nd second | ^~~~~~ Baijan.cpp:60:50: note: in expansion of macro 'nd' 60 | q.push({g[nu][i].st+odl,g[nu][i].nd}); | ^~ Baijan.cpp:60:53: error: no matching function for call to 'std::priority_queue<std::pair<int, int>, std::vector<std::pair<int, int> >, std::greater<std::pair<int, int> > >::push(<brace-enclosed initializer list>)' 60 | q.push({g[nu][i].st+odl,g[nu][i].nd}); | ^ In file included from /usr/include/c++/10/queue:64, from /usr/include/x86_64-linux-gnu/c++/10/bits/stdc++.h:86, from Baijan.cpp:1: /usr/include/c++/10/bits/stl_queue.h:640:7: note: candidate: 'void std::priority_queue<_Tp, _Sequence, _Compare>::push(const value_type&) [with _Tp = std::pair<int, int>; _Sequence = std::vector<std::pair<int, int> >; _Compare = std::greater<std::pair<int, int> >; std::priority_queue<_Tp, _Sequence, _Compare>::value_type = std::pair<int, int>]' 640 | push(const value_type& __x) | ^~~~ /usr/include/c++/10/bits/stl_queue.h:640:30: note: no known conversion for argument 1 from '<brace-enclosed initializer list>' to 'const value_type&' {aka 'const std::pair<int, int>&'} 640 | push(const value_type& __x) | ~~~~~~~~~~~~~~~~~~^~~ /usr/include/c++/10/bits/stl_queue.h:648:7: note: candidate: 'void std::priority_queue<_Tp, _Sequence, _Compare>::push(std::priority_queue<_Tp, _Sequence, _Compare>::value_type&&) [with _Tp = std::pair<int, int>; _Sequence = std::vector<std::pair<int, int> >; _Compare = std::greater<std::pair<int, int> >; std::priority_queue<_Tp, _Sequence, _Compare>::value_type = std::pair<int, int>]' 648 | push(value_type&& __x) | ^~~~ /usr/include/c++/10/bits/stl_queue.h:648:25: note: no known conversion for argument 1 from '<brace-enclosed initializer list>' to 'std::priority_queue<std::pair<int, int>, std::vector<std::pair<int, int> >, std::greater<std::pair<int, int> > >::value_type&&' {aka 'std::pair<int, int>&&'} 648 | push(value_type&& __x) | ~~~~~~~~~~~~~^~~