Submission #162303

#TimeUsernameProblemLanguageResultExecution timeMemory
162303NordwayCombo (IOI18_combo)C++14
Compilation error
0 ms0 KiB
#include<bits/stdc++.h> #define x first #define y second #define pb push_back #define mp make_pair #define up_b upper_bound #define low_b lower_bound #define sz(x) (int)x.size() #define all(v) v.begin(),v.end() #define nl '\n' #define boost ios_base::sync_with_stdio(0),cin.tie(0),cout.tie(0) using namespace std; typedef long long ll; typedef long double ld; typedef pair<int,int> pii; typedef pair<int,ll> pil; typedef pair<ll,int> pli; typedef pair<ll,ll> pll; const ll INF=1e18; const int inf=1e9; const ld eps=1e-7; const ld pi=acos(-1); const int dx[8]={0,0 ,1,-1,1,1,-1,-1}; const int dy[8]={1,-1,0,0,1,-1,1,-1}; const int mod1=998244353; const int mod=1e9+7; const int N=5e5+11; const int M=511111; string get_string(string s,int p){ if(p==1)return "B"+s+"XB"+s+"XX"+s+"XY"; else if(p==2)return "X"+s+"YX"+s+"YY"+s+"YA"; else if(p==3)return "Y"+s+"AY"+s+"AA"+s+"AB"; else if(p==4)return "A"+s+"BA"+s+"BB"+s+"BX"; } string get_char(int val,int p){ if(p==4){ if(val==0)return "X"; else if(val==1)return "A"; else return "B"; } else if(p==1){ if(val==0)return "Y"; else if(val==1)return "B"; else return "X"; } else if(p==2){ if(val==0)return "A"; else if(val==1)return "X"; else return "Y"; } else { if(val==0)return "B"; else if(val==1)return "Y"; else return "A"; } } string guess_string(int n){ string s=""; s="A"; int p; if(press(s)==1){ p=1; } else{ s="B"; if(press(s)==1){ p=2; } else{ s="X"; if(press(s)){ p=3; } else{ s="Y"; p=4; } } } for(int i=2;i<=n;i++){ string t=s+get_string(s,p); int val=press(t); if(val==sz(s))s=s+get_char(0,p); else if(val==sz(s)+1)s=s+get(1,p); else if(val==sz(s)+2)s=s+get(2,p); } return s; }

Compilation message (stderr)

combo.cpp: In function 'std::string guess_string(int)':
combo.cpp:67:6: error: 'press' was not declared in this scope
   67 |   if(press(s)==1){
      |      ^~~~~
combo.cpp:88:13: error: 'press' was not declared in this scope
   88 |     int val=press(t);
      |             ^~~~~
combo.cpp:90:37: error: no matching function for call to 'get(int, int&)'
   90 |     else if(val==sz(s)+1)s=s+get(1,p);
      |                                     ^
In file included from /usr/include/c++/10/algorithm:60,
                 from /usr/include/x86_64-linux-gnu/c++/10/bits/stdc++.h:65,
                 from combo.cpp:1:
/usr/include/c++/10/utility:223:5: note: candidate: 'template<long unsigned int _Int, class _Tp1, class _Tp2> constexpr typename std::tuple_element<_Int, std::pair<_Tp1, _Tp2> >::type& std::get(std::pair<_Tp1, _Tp2>&)'
  223 |     get(std::pair<_Tp1, _Tp2>& __in) noexcept
      |     ^~~
/usr/include/c++/10/utility:223:5: note:   template argument deduction/substitution failed:
combo.cpp:90:37: note:   mismatched types 'std::pair<_Tp1, _Tp2>' and 'int'
   90 |     else if(val==sz(s)+1)s=s+get(1,p);
      |                                     ^
In file included from /usr/include/c++/10/algorithm:60,
                 from /usr/include/x86_64-linux-gnu/c++/10/bits/stdc++.h:65,
                 from combo.cpp:1:
/usr/include/c++/10/utility:228:5: note: candidate: 'template<long unsigned int _Int, class _Tp1, class _Tp2> constexpr typename std::tuple_element<_Int, std::pair<_Tp1, _Tp2> >::type&& std::get(std::pair<_Tp1, _Tp2>&&)'
  228 |     get(std::pair<_Tp1, _Tp2>&& __in) noexcept
      |     ^~~
/usr/include/c++/10/utility:228:5: note:   template argument deduction/substitution failed:
combo.cpp:90:37: note:   mismatched types 'std::pair<_Tp1, _Tp2>' and 'int'
   90 |     else if(val==sz(s)+1)s=s+get(1,p);
      |                                     ^
In file included from /usr/include/c++/10/algorithm:60,
                 from /usr/include/x86_64-linux-gnu/c++/10/bits/stdc++.h:65,
                 from combo.cpp:1:
/usr/include/c++/10/utility:233:5: note: candidate: 'template<long unsigned int _Int, class _Tp1, class _Tp2> constexpr const typename std::tuple_element<_Int, std::pair<_Tp1, _Tp2> >::type& std::get(const std::pair<_Tp1, _Tp2>&)'
  233 |     get(const std::pair<_Tp1, _Tp2>& __in) noexcept
      |     ^~~
/usr/include/c++/10/utility:233:5: note:   template argument deduction/substitution failed:
combo.cpp:90:37: note:   mismatched types 'const std::pair<_Tp1, _Tp2>' and 'int'
   90 |     else if(val==sz(s)+1)s=s+get(1,p);
      |                                     ^
In file included from /usr/include/c++/10/algorithm:60,
                 from /usr/include/x86_64-linux-gnu/c++/10/bits/stdc++.h:65,
                 from combo.cpp:1:
/usr/include/c++/10/utility:238:5: note: candidate: 'template<long unsigned int _Int, class _Tp1, class _Tp2> constexpr const typename std::tuple_element<_Int, std::pair<_Tp1, _Tp2> >::type&& std::get(const std::pair<_Tp1, _Tp2>&&)'
  238 |     get(const std::pair<_Tp1, _Tp2>&& __in) noexcept
      |     ^~~
/usr/include/c++/10/utility:238:5: note:   template argument deduction/substitution failed:
combo.cpp:90:37: note:   mismatched types 'const std::pair<_Tp1, _Tp2>' and 'int'
   90 |     else if(val==sz(s)+1)s=s+get(1,p);
      |                                     ^
In file included from /usr/include/c++/10/algorithm:60,
                 from /usr/include/x86_64-linux-gnu/c++/10/bits/stdc++.h:65,
                 from combo.cpp:1:
/usr/include/c++/10/utility:247:5: note: candidate: 'template<class _Tp, class _Up> constexpr _Tp& std::get(std::pair<_T1, _T2>&)'
  247 |     get(pair<_Tp, _Up>& __p) noexcept
      |     ^~~
/usr/include/c++/10/utility:247:5: note:   template argument deduction/substitution failed:
combo.cpp:90:37: note:   mismatched types 'std::pair<_T1, _T2>' and 'int'
   90 |     else if(val==sz(s)+1)s=s+get(1,p);
      |                                     ^
In file included from /usr/include/c++/10/algorithm:60,
                 from /usr/include/x86_64-linux-gnu/c++/10/bits/stdc++.h:65,
                 from combo.cpp:1:
/usr/include/c++/10/utility:252:5: note: candidate: 'template<class _Tp, class _Up> constexpr const _Tp& std::get(const std::pair<_T1, _T2>&)'
  252 |     get(const pair<_Tp, _Up>& __p) noexcept
      |     ^~~
/usr/include/c++/10/utility:252:5: note:   template argument deduction/substitution failed:
combo.cpp:90:37: note:   mismatched types 'const std::pair<_T1, _T2>' and 'int'
   90 |     else if(val==sz(s)+1)s=s+get(1,p);
      |                                     ^
In file included from /usr/include/c++/10/algorithm:60,
                 from /usr/include/x86_64-linux-gnu/c++/10/bits/stdc++.h:65,
                 from combo.cpp:1:
/usr/include/c++/10/utility:257:5: note: candidate: 'template<class _Tp, class _Up> constexpr _Tp&& std::get(std::pair<_T1, _T2>&&)'
  257 |     get(pair<_Tp, _Up>&& __p) noexcept
      |     ^~~
/usr/include/c++/10/utility:257:5: note:   template argument deduction/substitution failed:
combo.cpp:90:37: note:   mismatched types 'std::pair<_T1, _T2>' and 'int'
   90 |     else if(val==sz(s)+1)s=s+get(1,p);
      |                                     ^
In file included from /usr/include/c++/10/algorithm:60,
                 from /usr/include/x86_64-linux-gnu/c++/10/bits/stdc++.h:65,
                 from combo.cpp:1:
/usr/include/c++/10/utility:262:5: note: candidate: 'template<class _Tp, class _Up> constexpr const _Tp&& std::get(const std::pair<_T1, _T2>&&)'
  262 |     get(const pair<_Tp, _Up>&& __p) noexcept
      |     ^~~
/usr/include/c++/10/utility:262:5: note:   template argument deduction/substitution failed:
combo.cpp:90:37: note:   mismatched types 'const std::pair<_T1, _T2>' and 'int'
   90 |     else if(val==sz(s)+1)s=s+get(1,p);
      |                                     ^
In file included from /usr/include/c++/10/algorithm:60,
                 from /usr/include/x86_64-linux-gnu/c++/10/bits/stdc++.h:65,
                 from combo.cpp:1:
/usr/include/c++/10/utility:267:5: note: candidate: 'template<class _Tp, class _Up> constexpr _Tp& std::get(std::pair<_Up, _Tp>&)'
  267 |     get(pair<_Up, _Tp>& __p) noexcept
      |     ^~~
/usr/include/c++/10/utility:267:5: note:   template argument deduction/substitution failed:
combo.cpp:90:37: note:   mismatched types 'std::pair<_Up, _Tp>' and 'int'
   90 |     else if(val==sz(s)+1)s=s+get(1,p);
      |                                     ^
In file included from /usr/include/c++/10/algorithm:60,
                 from /usr/include/x86_64-linux-gnu/c++/10/bits/stdc++.h:65,
                 from combo.cpp:1:
/usr/include/c++/10/utility:272:5: note: candidate: 'template<class _Tp, class _Up> constexpr const _Tp& std::get(const std::pair<_Up, _Tp>&)'
  272 |     get(const pair<_Up, _Tp>& __p) noexcept
      |     ^~~
/usr/include/c++/10/utility:272:5: note:   template argument deduction/substitution failed:
combo.cpp:90:37: note:   mismatched types 'const std::pair<_Up, _Tp>' and 'int'
   90 |     else if(val==sz(s)+1)s=s+get(1,p);
      |                                     ^
In file included from /usr/include/c++/10/algorithm:60,
                 from /usr/include/x86_64-linux-gnu/c++/10/bits/stdc++.h:65,
                 from combo.cpp:1:
/usr/include/c++/10/utility:277:5: note: candidate: 'template<class _Tp, class _Up> constexpr _Tp&& std::get(std::pair<_Up, _Tp>&&)'
  277 |     get(pair<_Up, _Tp>&& __p) noexcept
      |     ^~~
/usr/include/c++/10/utility:277:5: note:   template argument deduction/substitution failed:
combo.cpp:90:37: note:   mismatched types 'std::pair<_Up, _Tp>' and 'int'
   90 |     else if(val==sz(s)+1)s=s+get(1,p);
      |                                     ^
In file included from /usr/include/c++/10/algorithm:60,
                 from /usr/include/x86_64-linux-gnu/c++/10/bits/stdc++.h:65,
                 from combo.cpp:1:
/usr/include/c++/10/utility:282:5: note: candidate: 'template<class _Tp, class _Up> constexpr const _Tp&& std::get(const std::pair<_Up, _Tp>&&)'
  282 |     get(const pair<_Up, _Tp>&& __p) noexcept
      |     ^~~
/usr/include/c++/10/utility:282:5: note:   template argument deduction/substitution failed:
combo.cpp:90:37: note:   mismatched types 'const std::pair<_Up, _Tp>' and 'int'
   90 |     else if(val==sz(s)+1)s=s+get(1,p);
      |                                     ^
In file included from /usr/include/c++/10/tuple:39,
                 from /usr/include/c++/10/functional:54,
                 from /usr/include/x86_64-linux-gnu/c++/10/bits/stdc++.h:71,
                 from combo.cpp:1:
/usr/include/c++/10/array:334:5: note: candidate: 'template<long unsigned int _Int, class _Tp, long unsigned int _Nm> constexpr _Tp& std::get(std::array<_Tp, _Nm>&)'
  334 |     get(array<_Tp, _Nm>& __arr) noexcept
      |     ^~~
/usr/include/c++/10/array:334:5: note:   template argument deduction/substitution failed:
combo.cpp:90:37: note:   mismatched types 'std::array<_Tp, _Nm>' and 'int'
   90 |     else if(val==sz(s)+1)s=s+get(1,p);
      |                                     ^
In file included from /usr/include/c++/10/tuple:39,
                 from /usr/include/c++/10/functional:54,
                 from /usr/include/x86_64-linux-gnu/c++/10/bits/stdc++.h:71,
                 from combo.cpp:1:
/usr/include/c++/10/array:343:5: note: candidate: 'template<long unsigned int _Int, class _Tp, long unsigned int _Nm> constexpr _Tp&& std::get(std::array<_Tp, _Nm>&&)'
  343 |     get(array<_Tp, _Nm>&& __arr) noexcept
      |     ^~~
/usr/include/c++/10/array:343:5: note:   template argument deduction/substitution failed:
combo.cpp:90:37: note:   mismatched types 'std::array<_Tp, _Nm>' and 'int'
   90 |     else if(val==sz(s)+1)s=s+get(1,p);
      |                                     ^
In file included from /usr/include/c++/10/tuple:39,
                 from /usr/include/c++/10/functional:54,
                 from /usr/include/x86_64-linux-gnu/c++/10/bits/stdc++.h:71,
                 from combo.cpp:1:
/usr/include/c++/10/array:351:5: note: candidate: 'template<long unsigned int _Int, class _Tp, long unsigned int _Nm> constexpr const _Tp& std::get(const std::array<_Tp, _Nm>&)'
  351 |     get(const array<_Tp, _Nm>& __arr) noexcept
      |     ^~~
/usr/include/c++/10/array:351:5: note:   template argument deduction/substitution failed:
combo.cpp:90:37: note:   mismatched types 'const std::array<_Tp, _Nm>' and 'int'
   90 |     else if(val==sz(s)+1)s=s+get(1,p);
      |                                     ^
In file included from /usr/include/c++/10/tuple:39,
                 from /usr/include/c++/10/functional:54,
                 from /usr/include/x86_64-linux-gnu/c++/10/bits/stdc++.h:71,
                 from combo.cpp:1:
/usr/include/c++/10/array:360:5: note: candidate: 'template<long unsigned int _Int, class _Tp, long unsigned int _Nm> constexpr const _Tp&& std::get(const std::array<_Tp, _Nm>&&)'
  360 |     get(const array<_Tp, _Nm>&& __arr) noexcept
      |     ^~~
/usr/include/c++/10/array:360:5: note:   template argument deduction/substitution failed:
combo.cpp:90:37: note:   mismatched types 'const std::array<_Tp, _Nm>' and 'int'
   90 |     else if(val==sz(s)+1)s=s+get(1,p);
      |                                     ^
In file included from /usr/include/c++/10/functional:54,
                 from /usr/include/x86_64-linux-gnu/c++/10/bits/stdc++.h:71,
                 from combo.cpp:1:
/usr/include/c++/10/tuple:1294:5: note: candidate: 'template<long unsigned int __i, class ... _Elements> constexpr std::__tuple_element_t<__i, std::tuple<_Elements ...> >& std::get(std::tuple<_Elements ...>&)'
 1294 |     get(tuple<_Elements...>& __t) noexcept
      |     ^~~
/usr/include/c++/10/tuple:1294:5: note:   template argument deduction/substitution failed:
combo.cpp:90:37: note:   mismatched types 'std::tuple<_Elements ...>' and 'int'
   90 |     else if(val==sz(s)+1)s=s+get(1,p);
      |                                     ^
In file included from /usr/include/c++/10/functional:54,
                 from /usr/include/x86_64-linux-gnu/c++/10/bits/stdc++.h:71,
                 from combo.cpp:1:
/usr/include/c++/10/tuple:1300:5: note: candidate: 'template<long unsigned int __i, class ... _Elements> constexpr std::__tuple_element_t<__i, std::tuple<_Elements ...> >& std::get(const std::tuple<_Elements ...>&)'
 1300 |     get(const tuple<_Elements...>& __t) noexcept
      |     ^~~
/usr/include/c++/10/tuple:1300:5: note:   template argument deduction/substitution failed:
combo.cpp:90:37: note:   mismatched types 'const std::tuple<_Elements ...>' and 'int'
   90 |     else if(val==sz(s)+1)s=s+get(1,p);
      |                                     ^
In file included from /usr/include/c++/10/functional:54,
                 from /usr/include/x86_64-linux-gnu/c++/10/bits/stdc++.h:71,
                 from combo.cpp:1:
/usr/include/c++/10/tuple:1306:5: note: candidate: 'template<long unsigned int __i, class ... _Elements> constexpr std::__tuple_element_t<__i, std::tuple<_Elements ...> >&& std::get(std::tuple<_Elements ...>&&)'
 1306 |     get(tuple<_Elements...>&& __t) noexcept
      |     ^~~
/usr/include/c++/10/tuple:1306:5: note:   template argument deduction/substitution failed:
combo.cpp:90:37: note:   mismatched types 'std::tuple<_Elements ...>' and 'int'
   90 |     else if(val==sz(s)+1)s=s+get(1,p);
      |                                     ^
In file included from /usr/include/c++/10/functional:54,
                 from /usr/include/x86_64-linux-gnu/c++/10/bits/stdc++.h:71,
                 from combo.cpp:1:
/usr/include/c++/10/tuple:1315:5: note: candidate: 'template<long unsigned int __i, class ... _Elements> constexpr std::__tuple_element_t<__i, std::tuple<_Elements ...> >&& std::get(const std::tuple<_Elements ...>&&)'
 1315 |     get(const tuple<_Elements...>&& __t) noexcept
      |     ^~~
/usr/include/c++/10/tuple:1315:5: note:   template argument deduction/substitution failed:
combo.cpp:90:37: note:   mismatched types 'const std::tuple<_Elements ...>' and 'int'
   90 |     else if(val==sz(s)+1)s=s+get(1,p);
      |                                     ^
In file included from /usr/include/c++/10/functional:54,
                 from /usr/include/x86_64-linux-gnu/c++/10/bits/stdc++.h:71,
                 from combo.cpp:1:
/usr/include/c++/10/tuple:1338:5: note: candidate: 'template<class _Tp, class ... _Types> constexpr _Tp& std::get(std::tuple<_Elements ...>&)'
 1338 |     get(tuple<_Types...>& __t) noexcept
      |     ^~~
/usr/include/c++/10/tuple:1338:5: note:   template argument deduction/substitution failed:
combo.cpp:90:37: note:   mismatched types 'std::tuple<_Elements ...>' and 'int'
   90 |     else if(val==sz(s)+1)s=s+get(1,p);
      |                                     ^
In file included from /usr/include/c++/10/functional:54,
                 from /usr/include/x86_64-linux-gnu/c++/10/bits/stdc++.h:71,
                 from combo.cpp:1:
/usr/include/c++/10/tuple:1344:5: note: candidate: 'template<class _Tp, class ... _Types> constexpr _Tp&& std::get(std::tuple<_Elements ...>&&)'
 1344 |     get(tuple<_Types...>&& __t) noexcept
      |     ^~~
/usr/include/c++/10/tuple:1344:5: note:   template argument deduction/substitution failed:
combo.cpp:90:37: note:   mismatched types 'std::tuple<_Elements ...>' and 'int'
   90 |     else if(val==sz(s)+1)s=s+get(1,p);
      |                                     ^
In file included from /usr/include/c++/10/functional:54,
                 from /usr/include/x86_64-linux-gnu/c++/10/bits/stdc++.h:71,
                 from combo.cpp:1:
/usr/include/c++/10/tuple:1350:5: note: candidate: 'template<class _Tp, class ... _Types> constexpr const _Tp& std::get(const std::tuple<_Elements ...>&)'
 1350 |     get(const tuple<_Types...>& __t) noexcept
      |     ^~~
/usr/include/c++/10/tuple:1350:5: note:   template argument deduction/substitution failed:
combo.cpp:90:37: note:   mismatched types 'const std::tuple<_Elements ...>' and 'int'
   90 |     else if(val==sz(s)+1)s=s+get(1,p);
      |                                     ^
In file included from /usr/include/c++/10/functional:54,
                 from /usr/include/x86_64-linux-gnu/c++/10/bits/stdc++.h:71,
                 from combo.cpp:1:
/usr/include/c++/10/tuple:1357:5: note: candidate: 'template<class _Tp, class ... _Types> constexpr const _Tp&& std::get(const std::tuple<_Elements ...>&&)'
 1357 |     get(const tuple<_Types...>&& __t) noexcept
      |     ^~~
/usr/include/c++/10/tuple:1357:5: note:   template argument deduction/substitution failed:
combo.cpp:90:37: note:   mismatched types 'const std::tuple<_Elements ...>' and 'int'
   90 |     else if(val==sz(s)+1)s=s+get(1,p);
      |                                     ^
combo.cpp:91:37: error: no matching function for call to 'get(int, int&)'
   91 |     else if(val==sz(s)+2)s=s+get(2,p);
      |                                     ^
In file included from /usr/include/c++/10/algorithm:60,
                 from /usr/include/x86_64-linux-gnu/c++/10/bits/stdc++.h:65,
                 from combo.cpp:1:
/usr/include/c++/10/utility:223:5: note: candidate: 'template<long unsigned int _Int, class _Tp1, class _Tp2> constexpr typename std::tuple_element<_Int, std::pair<_Tp1, _Tp2> >::type& std::get(std::pair<_Tp1, _Tp2>&)'
  223 |     get(std::pair<_Tp1, _Tp2>& __in) noexcept
      |     ^~~
/usr/include/c++/10/utility:223:5: note:   template argument deduction/substitution failed:
combo.cpp:91:37: note:   mismatched types 'std::pair<_Tp1, _Tp2>' and 'int'
   91 |     else if(val==sz(s)+2)s=s+get(2,p);
      |                                     ^
In file included from /usr/include/c++/10/algorithm:60,
                 from /usr/include/x86_64-linux-gnu/c++/10/bits/stdc++.h:65,
                 from combo.cpp:1:
/usr/include/c++/10/utility:228:5: note: candidate: 'template<long unsigned int _Int, class _Tp1, class _Tp2> constexpr typename std::tuple_element<_Int, std::pair<_Tp1, _Tp2> >::type&& std::get(std::pair<_Tp1, _Tp2>&&)'
  228 |     get(std::pair<_Tp1, _Tp2>&& __in) noexcept
      |     ^~~
/usr/include/c++/10/utility:228:5: note:   template argument deduction/substitution f