Submission #1086425

#TimeUsernameProblemLanguageResultExecution timeMemory
1086425asli_bgTropical Garden (IOI11_garden)C++11
Compilation error
0 ms0 KiB
#include "garden.h" #include "gardenlib.h" #include<bits/stdc++.h> using namespace std; #define int long long #define fi first #define se second #define all(x) x.begin(),x.end() #define pb push_back typedef vector<int> vi; typedef pair<int,int> pii; typedef vector<pii> vii; typedef vector<bool> vb; #define sp <<' '<< #define FOR(i,a) for(int i=0;i<(a);i++) #define FORE(i,a,b) for(int i=(a);i<(b);i++) #define cont(x) {for(auto el:x) cout<<el<<' ';cout<<endl;} #define contp(x) {for(auto el:x) cout<<el.fi<<'-'<<el.se<<' ';cout<<endl;} #define DEBUG(X) { cout << #X << " = " << (X) << endl; } #define carp(x,y) (((x)%mod)*((y)%mod))%mod #define topla(x,y) (((x)%mod)+((y)%mod))%mod const int MAXN=2e5+4; const int MAXK=25; #define mid (l+r)/2 #define endl '\n' int n,m,p; pii adj[MAXN]; int suc[MAXN][MAXK][2]; int gir[MAXN][MAXK][2]; int cik[MAXN][MAXK][2]; //suc[n][k][b]={a,c} --> n.nodedan k kez ilerlersem a.ya ulaşırım b.edgei kullanarak void calc(){ FORE(k,1,MAXK){ FORE(nd,1,n+1){ /* suc[nd][k-1][1]--> 1 routeunda nd den 2^(k-1) ilerle bu nodedan da 2^(k-1) ilerle hangi routta? cikis[nd][k-1][1] routunda cikis[nd][k][1] neye eşit? yarıdaki nodeun k-1 gez ilerledikten sonra belirlenen routta ulaştığı nodeun ciki */ suc[nd][k][1]=suc[suc[nd][k-1][1]][k-1][cik[nd][k-1][1]];//min edge i kullan da gel cik[nd][k][1]=cik[suc[nd][k-1][1]][k-1][cik[nd][k-1][1]]; gir[nd][k][1]=2; suc[nd][k][2]=suc[suc[nd][k-1][2]][k-1][cik[nd][k-1][2]];//min edge i kullan da gel cik[nd][k][2]=cik[suc[nd][k-1][2]][k-1][cik[nd][k-1][2]]; gir[nd][k][2]=1; } } } void count_routes(int N, int M, int P, int R[][2], int Q, int G[]) { n=N; m=M; p=P; FORE(i,1,m+1){ int from=R[i][0]; int to=R[i][1]; adj[from].pb({i-1,to}); adj[to].pb({i-1,from}); } FORE(i,1,n+1){ sort(all(adj[i])); while(adj[i].size()>2) adj[i].pop_back(); //route if i go from the min edge int kom=adj[i][0].se; int cost=adj[i][0].fi; suc[i][0][1]=kom; //1--> min edgele cik gir[i][0][1]=2; // maxla gir if(adj[kom][0].se==i and adj[kom].size()>1){ //komsumun min edge i de benle aramdakiyse cik[i][0][1]=2;//adj[kom][1].fi; //cik su an üstünde bulunduğum nodeun kullanılmasını //istediğim edgei } else{ cik[i][0][1]=1;//adj[kom][0].fi; } if(adj[i].size()>=2){ //2.bir route varsa //try calculating the other edge kom=adj[i][1].se; cost=adj[i][1].fi; suc[i][0][2]=kom; //1-->max edgele cik gir[i][0][2]=1; //minle gir if(adj[kom][0].se==i and adj[kom].size()>1){ //komsumun min edge i de benle aramdakiyse cik[i][0][2]=2;//adj[kom][1].fi; } else{ cik[i][0][2]=1;//adj[kom][0].fi; } } } //calculate successor of each node calc(); int q=Q; vii qq, cc; while(q--){ int deg; cin>>deg; qq.pb(deg); cc.pb(deg); } sort(all(qq)); vi cur(n+1); map<int,int> cev; FORE(i,1,n+1) cur[i]=i; int once=0; for(auto el:qq){ //el kadar tüm nodeları ilerlet el-=once; FORE(i,1,MAXK){ if((1<<i)>el) break; if(el&(1<<i)!=0){ FORE(nd,1,n+1){ cur[nd]=suc[nd][i][1]; } } } FORE(nd,1,n+1){ if(cur[nd]==p) cev[el]++; } once+=el; } for(auto el:cc){ answer(cev[el]); } }

Compilation message (stderr)

garden.cpp: In function 'void count_routes(long long int, long long int, long long int, long long int (*)[2], long long int, long long int*)':
garden.cpp:12:12: error: 'pii' {aka 'struct std::pair<long long int, long long int>'} has no member named 'push_back'
   12 | #define pb push_back
      |            ^~~~~~~~~
garden.cpp:73:19: note: in expansion of macro 'pb'
   73 |         adj[from].pb({i-1,to});
      |                   ^~
garden.cpp:12:12: error: 'pii' {aka 'struct std::pair<long long int, long long int>'} has no member named 'push_back'
   12 | #define pb push_back
      |            ^~~~~~~~~
garden.cpp:74:17: note: in expansion of macro 'pb'
   74 |         adj[to].pb({i-1,from});
      |                 ^~
garden.cpp:11:18: error: 'pii' {aka 'struct std::pair<long long int, long long int>'} has no member named 'begin'
   11 | #define all(x) x.begin(),x.end()
      |                  ^~~~~
garden.cpp:78:14: note: in expansion of macro 'all'
   78 |         sort(all(adj[i]));
      |              ^~~
garden.cpp:11:28: error: 'pii' {aka 'struct std::pair<long long int, long long int>'} has no member named 'end'
   11 | #define all(x) x.begin(),x.end()
      |                            ^~~
garden.cpp:78:14: note: in expansion of macro 'all'
   78 |         sort(all(adj[i]));
      |              ^~~
garden.cpp:79:22: error: 'pii' {aka 'struct std::pair<long long int, long long int>'} has no member named 'size'
   79 |         while(adj[i].size()>2) adj[i].pop_back();
      |                      ^~~~
garden.cpp:79:39: error: 'pii' {aka 'struct std::pair<long long int, long long int>'} has no member named 'pop_back'
   79 |         while(adj[i].size()>2) adj[i].pop_back();
      |                                       ^~~~~~~~
garden.cpp:82:23: error: no match for 'operator[]' (operand types are 'pii' {aka 'std::pair<long long int, long long int>'} and 'int')
   82 |         int kom=adj[i][0].se;
      |                       ^
garden.cpp:83:24: error: no match for 'operator[]' (operand types are 'pii' {aka 'std::pair<long long int, long long int>'} and 'int')
   83 |         int cost=adj[i][0].fi;
      |                        ^
garden.cpp:86:20: error: no match for 'operator[]' (operand types are 'pii' {aka 'std::pair<long long int, long long int>'} and 'int')
   86 |         if(adj[kom][0].se==i and adj[kom].size()>1){ //komsumun min edge i de benle aramdakiyse
      |                    ^
garden.cpp:86:43: error: 'pii' {aka 'struct std::pair<long long int, long long int>'} has no member named 'size'
   86 |         if(adj[kom][0].se==i and adj[kom].size()>1){ //komsumun min edge i de benle aramdakiyse
      |                                           ^~~~
garden.cpp:95:19: error: 'pii' {aka 'struct std::pair<long long int, long long int>'} has no member named 'size'
   95 |         if(adj[i].size()>=2){ //2.bir route varsa
      |                   ^~~~
garden.cpp:97:23: error: no match for 'operator[]' (operand types are 'pii' {aka 'std::pair<long long int, long long int>'} and 'int')
   97 |             kom=adj[i][1].se;
      |                       ^
garden.cpp:98:24: error: no match for 'operator[]' (operand types are 'pii' {aka 'std::pair<long long int, long long int>'} and 'int')
   98 |             cost=adj[i][1].fi;
      |                        ^
garden.cpp:101:24: error: no match for 'operator[]' (operand types are 'pii' {aka 'std::pair<long long int, long long int>'} and 'int')
  101 |             if(adj[kom][0].se==i and adj[kom].size()>1){ //komsumun min edge i de benle aramdakiyse
      |                        ^
garden.cpp:101:47: error: 'pii' {aka 'struct std::pair<long long int, long long int>'} has no member named 'size'
  101 |             if(adj[kom][0].se==i and adj[kom].size()>1){ //komsumun min edge i de benle aramdakiyse
      |                                               ^~~~
garden.cpp:119:18: error: no matching function for call to 'std::vector<std::pair<long long int, long long int> >::push_back(long long int&)'
  119 |         qq.pb(deg);
      |                  ^
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 garden.cpp:4:
/usr/include/c++/10/bits/stl_vector.h:1187:7: note: candidate: 'void std::vector<_Tp, _Alloc>::push_back(const value_type&) [with _Tp = std::pair<long long int, long long int>; _Alloc = std::allocator<std::pair<long long int, long long int> >; std::vector<_Tp, _Alloc>::value_type = std::pair<long long int, 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 'long long int' to 'const value_type&' {aka 'const std::pair<long long int, 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 = std::pair<long long int, long long int>; _Alloc = std::allocator<std::pair<long long int, long long int> >; std::vector<_Tp, _Alloc>::value_type = std::pair<long long int, 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 'long long int' to 'std::vector<std::pair<long long int, long long int> >::value_type&&' {aka 'std::pair<long long int, long long int>&&'}
 1203 |       push_back(value_type&& __x)
      |                 ~~~~~~~~~~~~~^~~
garden.cpp:120:18: error: no matching function for call to 'std::vector<std::pair<long long int, long long int> >::push_back(long long int&)'
  120 |         cc.pb(deg);
      |                  ^
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 garden.cpp:4:
/usr/include/c++/10/bits/stl_vector.h:1187:7: note: candidate: 'void std::vector<_Tp, _Alloc>::push_back(const value_type&) [with _Tp = std::pair<long long int, long long int>; _Alloc = std::allocator<std::pair<long long int, long long int> >; std::vector<_Tp, _Alloc>::value_type = std::pair<long long int, 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 'long long int' to 'const value_type&' {aka 'const std::pair<long long int, 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 = std::pair<long long int, long long int>; _Alloc = std::allocator<std::pair<long long int, long long int> >; std::vector<_Tp, _Alloc>::value_type = std::pair<long long int, 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 'long long int' to 'std::vector<std::pair<long long int, long long int> >::value_type&&' {aka 'std::pair<long long int, long long int>&&'}
 1203 |       push_back(value_type&& __x)
      |                 ~~~~~~~~~~~~~^~~
garden.cpp:132:11: error: no match for 'operator-=' (operand types are 'std::pair<long long int, long long int>' and 'long long int')
  132 |         el-=once;
      |         ~~^~~~~~
garden.cpp:134:22: error: no match for 'operator>' (operand types are 'int' and 'std::pair<long long int, long long int>')
  134 |             if((1<<i)>el) break;
      |                ~~~~~~^~~
      |                  |    |
      |                  int  std::pair<long long int, long long int>
In file included from /usr/include/c++/10/regex:62,
                 from /usr/include/x86_64-linux-gnu/c++/10/bits/stdc++.h:110,
                 from garden.cpp:4:
/usr/include/c++/10/bits/regex.h:1108:5: note: candidate: 'template<class _BiIter> bool std::__cxx11::operator>(const std::__cxx11::sub_match<_BiIter>&, const std::__cxx11::sub_match<_BiIter>&)'
 1108 |     operator>(const sub_match<_BiIter>& __lhs, const sub_match<_BiIter>& __rhs)
      |     ^~~~~~~~
/usr/include/c++/10/bits/regex.h:1108:5: note:   template argument deduction/substitution failed:
garden.cpp:134:23: note:   mismatched types 'const std::__cxx11::sub_match<_BiIter>' and 'int'
  134 |             if((1<<i)>el) break;
      |                       ^~
In file included from /usr/include/c++/10/regex:62,
                 from /usr/include/x86_64-linux-gnu/c++/10/bits/stdc++.h:110,
                 from garden.cpp:4:
/usr/include/c++/10/bits/regex.h:1168:5: note: candidate: 'template<class _Bi_iter, class _Ch_traits, class _Ch_alloc> bool std::__cxx11::operator>(std::__cxx11::__sub_match_string<_Bi_iter, _Ch_traits, _Ch_alloc>&, const std::__cxx11::sub_match<_BiIter>&)'
 1168 |     operator>(const __sub_match_string<_Bi_iter, _Ch_traits, _Ch_alloc>& __lhs,
      |     ^~~~~~~~
/usr/include/c++/10/bits/regex.h:1168:5: note:   template argument deduction/substitution failed:
garden.cpp:134:23: note:   mismatched types 'std::__cxx11::__sub_match_string<_Bi_iter, _Ch_traits, _Ch_alloc>' and 'int'
  134 |             if((1<<i)>el) break;
      |                       ^~
In file included from /usr/include/c++/10/regex:62,
                 from /usr/include/x86_64-linux-gnu/c++/10/bits/stdc++.h:110,
                 from garden.cpp:4:
/usr/include/c++/10/bits/regex.h:1261:5: note: candidate: 'template<class _Bi_iter, class _Ch_traits, class _Ch_alloc> bool std::__cxx11::operator>(const std::__cxx11::sub_match<_BiIter>&, std::__cxx11::__sub_match_string<_Bi_iter, _Ch_traits, _Ch_alloc>&)'
 1261 |     operator>(const sub_match<_Bi_iter>& __lhs,
      |     ^~~~~~~~
/usr/include/c++/10/bits/regex.h:1261:5: note:   template argument deduction/substitution failed:
garden.cpp:134:23: note:   mismatched types 'const std::__cxx11::sub_match<_BiIter>' and 'int'
  134 |             if((1<<i)>el) break;
      |                       ^~
In file included from /usr/include/c++/10/regex:62,
                 from /usr/include/x86_64-linux-gnu/c++/10/bits/stdc++.h:110,
                 from garden.cpp:4:
/usr/include/c++/10/bits/regex.h:1335:5: note: candidate: 'template<class _Bi_iter> bool std::__cxx11::operator>(const typename std::iterator_traits<_Iter>::value_type*, const std::__cxx11::sub_match<_BiIter>&)'
 1335 |     operator>(typename iterator_traits<_Bi_iter>::value_type const* __lhs,
      |     ^~~~~~~~
/usr/include/c++/10/bits/regex.h:1335:5: note:   template argument deduction/substitution failed:
garden.cpp:134:23: note:   'std::pair<long long int, long long int>' is not derived from 'const std::__cxx11::sub_match<_BiIter>'
  134 |             if((1<<i)>el) break;
      |                       ^~
In file included from /usr/include/c++/10/regex:62,
                 from /usr/include/x86_64-linux-gnu/c++/10/bits/stdc++.h:110,
                 from garden.cpp:4:
/usr/include/c++/10/bits/regex.h:1429:5: note: candidate: 'template<class _Bi_iter> bool std::__cxx11::operator>(const std::__cxx11::sub_match<_BiIter>&, const typename std::iterator_traits<_Iter>::value_type*)'
 1429 |     operator>(const sub_match<_Bi_iter>& __lhs,
      |     ^~~~~~~~
/usr/include/c++/10/bits/regex.h:1429:5: note:   template argument deduction/substitution failed:
garden.cpp:134:23: note:   mismatched types 'const std::__cxx11::sub_match<_BiIter>' and 'int'
  134 |             if((1<<i)>el) break;
      |                       ^~
In file included from /usr/include/c++/10/regex:62,
                 from /usr/include/x86_64-linux-gnu/c++/10/bits/stdc++.h:110,
                 from garden.cpp:4:
/usr/include/c++/10/bits/regex.h:1505:5: note: candidate: 'template<class _Bi_iter> bool std::__cxx11::operator>(const typename std::iterator_traits<_Iter>::value_type&, const std::__cxx11::sub_match<_BiIter>&)'
 1505 |     operator>(typename iterator_traits<_Bi_iter>::value_type const& __lhs,
      |     ^~~~~~~~
/usr/include/c++/10/bits/regex.h:1505:5: note:   template argument deduction/substitution failed:
garden.cpp:134:23: note:   'std::pair<long long int, long long int>' is not derived from 'const std::__cxx11::sub_match<_BiIter>'
  134 |             if((1<<i)>el) break;
      |                       ^~
In file included from /usr/include/c++/10/regex:62,
                 from /usr/include/x86_64-linux-gnu/c++/10/bits/stdc++.h:110,
                 from garden.cpp:4:
/usr/include/c++/10/bits/regex.h:1605:5: note: candidate: 'template<class _Bi_iter> bool std::__cxx11::operator>(const std::__cxx11::sub_match<_BiIter>&, const typename std::iterator_traits<_Iter>::value_type&)'
 1605 |     operator>(const sub_match<_Bi_iter>& __lhs,
      |     ^~~~~~~~
/usr/include/c++/10/bits/regex.h:1605:5: note:   template argument deduction/substitution failed:
garden.cpp:134:23: note:   mismatched types 'const std::__cxx11::sub_match<_BiIter>' and 'int'
  134 |             if((1<<i)>el) break;
      |                       ^~
In file included from /usr/include/c++/10/bits/stl_algobase.h:64,
                 from /usr/include/c++/10/bits/char_traits.h:39,
                 from /usr/include/c++/10/ios:40,
                 from /usr/include/c++/10/istream:38,
                 from /usr/include/c++/10/sstream:38,
                 from /usr/include/c++/10/complex:45,
                 from /usr/include/c++/10/ccomplex:39,
                 from /usr/include/x86_64-linux-gnu/c++/10/bits/stdc++.h:54,
                 from garden.cpp:4:
/usr/include/c++/10/bits/stl_pair.h:502:5: note: candidate: 'template<class _T1, class _T2> constexpr bool std::operator>(const std::pair<_T1, _T2>&, const std::pair<_T1, _T2>&)'
  502 |     operator>(const pair<_T1, _T2>& __x, const pair<_T1, _T2>& __y)
      |     ^~~~~~~~
/usr/include/c++/10/bits/stl_pair.h:502:5: note:   template argument deduction/substitution failed:
garden.cpp:134:23: note:   mismatched types 'const std::pair<_T1, _T2>' and 'int'
  134 |             if((1<<i)>el) break;
      |                       ^~
In file included from /usr/include/c++/10/bits/stl_algobase.h:67,
                 from /usr/include/c++/10/bits/char_traits.h:39,
                 from /usr/include/c++/10/ios:40,
                 from /usr/include/c++/10/istream:38,
                 from /usr/include/c++/10/sstream:38,
                 from /usr/include/c++/10/complex:45,
                 from /usr/include/c++/10/ccomplex:39,
                 from /usr/include/x86_64-linux-gnu/c++/10/bits/stdc++.h:54,
                 from garden.cpp:4:
/usr/include/c++/10/bits/stl_iterator.h:378:5: note: candidate: 'template<class _Iterator> bool std::operator>(const std::reverse_iterator<_Iterator>&, const std::reverse_iterator<_Iterator>&)'
  378 |     operator>(const reverse_iterator<_Iterator>& __x,
      |     ^~~~~~~~
/usr/include/c++/10/bits/stl_iterator.h:378:5: note:   template argument deduction/substitution failed:
garden.cpp:134:23: note:   mismatched types 'const std::reverse_iterator<_Iterator>' and 'int'
  134 |             if((1<<i)>el) break;
      |                       ^~
In file included from /usr/include/c++/10/bits/stl_algobase.h:67,
                 from /usr/include/c++/10/bits/char_traits.h:39,
                 from /usr/include/c++/10/ios:40,
                 from /usr/include/c++/10/istream:38,
                 from /usr/include/c++/10/sstream:38,
                 from /usr/include/c++/10/complex:45,
                 from /usr/include/c++/10/ccomplex:39,
                 from /usr/include/x86_64-linux-gnu/c++/10/bits/stdc++.h:54,
                 from garden.cpp:4:
/usr/include/c++/10/bits/stl_iterator.h:416:5: note: candidate: 'template<class _IteratorL, class _IteratorR> bool std::operator>(const std::reverse_iterator<_Iterator>&, const std::reverse_iterator<_IteratorR>&)'
  416 |     operator>(const reverse_iterator<_IteratorL>& __x,
      |     ^~~~~~~~
/usr/include/c++/10/bits/stl_iterator.h:416:5: note:   template argument deduction/substitution failed:
garden.cpp:134:23: note:   mismatched types 'const std::reverse_iterator<_Iterator>' and 'int'
  134 |             if((1<<i)>el) break;
      |                       ^~
In file included from /usr/include/c++/10/bits/stl_algobase.h:67,
                 from /usr/include/c++/10/bits/char_traits.h:39,
                 from /usr/include/c++/10/ios:40,
                 from /usr/include/c++/10/istream:38,
                 from /usr/include/c++/10/sstream:38,
                 from /usr/include/c++/10/complex:45,
                 from /usr/include/c++/10/ccomplex:39,
                 from /usr/include/x86_64-linux-gnu/c++/10/bits/stdc++.h:54,
                 from garden.cpp:4:
/usr/include/c++/10/bits/stl_iterator.h:1469:5: note: candidate: 'template<class _IteratorL, class _IteratorR> bool std::operator>(const std::move_iterator<_IteratorL>&, const std::move_iterator<_IteratorR>&)'
 1469 |     operator>(const move_iterator<_IteratorL>& __x,
      |     ^~~~~~~~
/usr/include/c++/10/bits/stl_iterator.h:1469:5: note:   template argument deduction/substitution failed:
garden.cpp:134:23: note:   mismatched types 'const std::move_iterator<_IteratorL>' and 'int'
  134 |             if((1<<i)>el) break;
      |                       ^~
In file included from /usr/include/c++/10/bits/stl_algobase.h:67,
                 from /usr/include/c++/10/bits/char_traits.h:39,
                 from /usr/include/c++/10/ios:40,
                 from /usr/include/c++/10/istream:38,
                 from /usr/include/c++/10/sstream:38,
                 from /usr/include/c++/10/complex:45,
                 from /usr/include/c++/10/ccomplex:39,
                 from /usr/include/x86_64-linux-gnu/c++/10/bits/stdc++.h:54,
                 from garden.cpp:4:
/usr/include/c++/10/bits/stl_iterator.h:1519:5: note: candidate: 'template<class _Iterator> bool std::operator>(const std::move_iterator<_IteratorL>&, const std::move_iterator<_IteratorL>&)'
 1519 |     operator>(const move_iterator<_Iterator>& __x,
      |     ^~~~~~~~
/usr/include/c++/10/bits/stl_iterator.h:1519:5: note:   template argument deduction/substitution failed:
garden.cpp:134:23: note:   mismatched types 'const std::move_iterator<_IteratorL>' and