Submission #856594

#TimeUsernameProblemLanguageResultExecution timeMemory
8565948pete8Combo (IOI18_combo)C++14
Compilation error
0 ms0 KiB
#include<iostream> #include<stack> #include<map> #include<vector> #include<string> #include<unordered_map> #include <queue> #include<cstring> #include<limits.h> #include<cmath> #include<set> #include<algorithm> #include<bitset> #include "combo.h" using namespace std; #define ll long long #define f first #define endl "\n" #define s second #define pii pair<int,int> #define ppii pair<int,pii> #define pb push_back #define p push #define all(x) x.begin(),x.end() #define rall(x) x.rbegin(),x.rend() #define F(n) for(int i=0;i<n;i++) #define lb lower_bound #define ub upper_bound #define fastio ios::sync_with_stdio(false);cin.tie(NULL); using namespace std; string guess_sequence(int N){ char v[4]={'A','B','X','Y'}; string op="",ans="",tmp; if(press("AB")){ if(press("A"))ans="A"; else ans="B"; } else if(press("x"))ans="X"; else ans="Y"; if(N==1)return ans; for(int i=0;i<4;i++)if(v[i]!=ans)op+=v[i]; for(int i=1;i<N-1;i++){ string a=ans+op[0]+op[1]+ans+op[0]+op[2]+ans+op[0]+op[0]+ans+op[1]; int b=press(a); if(b==1)ans+=op[1]; else if(b==2)ans+=op[0]; else ans+=op[2]; } for(int i=0;i<3;i++){ string v=ans+op[i]; if(i==2)ans=v; else if(press(v)==N)ans=v; } return ans; }

Compilation message (stderr)

combo.cpp: In function 'std::string guess_sequence(int)':
combo.cpp:41:32: error: no match for 'operator!=' (operand types are 'char' and 'std::string' {aka 'std::__cxx11::basic_string<char>'})
   41 |     for(int i=0;i<4;i++)if(v[i]!=ans)op+=v[i];
      |                            ~~~~^~~~~
      |                               |  |
      |                               |  std::string {aka std::__cxx11::basic_string<char>}
      |                               char
In file included from /usr/include/c++/10/iosfwd:40,
                 from /usr/include/c++/10/ios:38,
                 from /usr/include/c++/10/ostream:38,
                 from /usr/include/c++/10/iostream:39,
                 from combo.cpp:1:
/usr/include/c++/10/bits/postypes.h:227:5: note: candidate: 'template<class _StateT> bool std::operator!=(const std::fpos<_StateT>&, const std::fpos<_StateT>&)'
  227 |     operator!=(const fpos<_StateT>& __lhs, const fpos<_StateT>& __rhs)
      |     ^~~~~~~~
/usr/include/c++/10/bits/postypes.h:227:5: note:   template argument deduction/substitution failed:
combo.cpp:41:34: note:   mismatched types 'const std::fpos<_StateT>' and 'char'
   41 |     for(int i=0;i<4;i++)if(v[i]!=ans)op+=v[i];
      |                                  ^~~
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/ostream:38,
                 from /usr/include/c++/10/iostream:39,
                 from combo.cpp:1:
/usr/include/c++/10/bits/stl_pair.h:496:5: note: candidate: 'template<class _T1, class _T2> constexpr bool std::operator!=(const std::pair<_T1, _T2>&, const std::pair<_T1, _T2>&)'
  496 |     operator!=(const pair<_T1, _T2>& __x, const pair<_T1, _T2>& __y)
      |     ^~~~~~~~
/usr/include/c++/10/bits/stl_pair.h:496:5: note:   template argument deduction/substitution failed:
combo.cpp:41:34: note:   mismatched types 'const std::pair<_T1, _T2>' and 'char'
   41 |     for(int i=0;i<4;i++)if(v[i]!=ans)op+=v[i];
      |                                  ^~~
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/ostream:38,
                 from /usr/include/c++/10/iostream:39,
                 from combo.cpp:1:
/usr/include/c++/10/bits/stl_iterator.h:372:5: note: candidate: 'template<class _Iterator> bool std::operator!=(const std::reverse_iterator<_Iterator>&, const std::reverse_iterator<_Iterator>&)'
  372 |     operator!=(const reverse_iterator<_Iterator>& __x,
      |     ^~~~~~~~
/usr/include/c++/10/bits/stl_iterator.h:372:5: note:   template argument deduction/substitution failed:
combo.cpp:41:34: note:   mismatched types 'const std::reverse_iterator<_Iterator>' and 'char'
   41 |     for(int i=0;i<4;i++)if(v[i]!=ans)op+=v[i];
      |                                  ^~~
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/ostream:38,
                 from /usr/include/c++/10/iostream:39,
                 from combo.cpp:1:
/usr/include/c++/10/bits/stl_iterator.h:410:5: note: candidate: 'template<class _IteratorL, class _IteratorR> bool std::operator!=(const std::reverse_iterator<_Iterator>&, const std::reverse_iterator<_IteratorR>&)'
  410 |     operator!=(const reverse_iterator<_IteratorL>& __x,
      |     ^~~~~~~~
/usr/include/c++/10/bits/stl_iterator.h:410:5: note:   template argument deduction/substitution failed:
combo.cpp:41:34: note:   mismatched types 'const std::reverse_iterator<_Iterator>' and 'char'
   41 |     for(int i=0;i<4;i++)if(v[i]!=ans)op+=v[i];
      |                                  ^~~
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/ostream:38,
                 from /usr/include/c++/10/iostream:39,
                 from combo.cpp:1:
/usr/include/c++/10/bits/stl_iterator.h:1444:5: note: candidate: 'template<class _IteratorL, class _IteratorR> bool std::operator!=(const std::move_iterator<_IteratorL>&, const std::move_iterator<_IteratorR>&)'
 1444 |     operator!=(const move_iterator<_IteratorL>& __x,
      |     ^~~~~~~~
/usr/include/c++/10/bits/stl_iterator.h:1444:5: note:   template argument deduction/substitution failed:
combo.cpp:41:34: note:   mismatched types 'const std::move_iterator<_IteratorL>' and 'char'
   41 |     for(int i=0;i<4;i++)if(v[i]!=ans)op+=v[i];
      |                                  ^~~
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/ostream:38,
                 from /usr/include/c++/10/iostream:39,
                 from combo.cpp:1:
/usr/include/c++/10/bits/stl_iterator.h:1501:5: note: candidate: 'template<class _Iterator> bool std::operator!=(const std::move_iterator<_IteratorL>&, const std::move_iterator<_IteratorL>&)'
 1501 |     operator!=(const move_iterator<_Iterator>& __x,
      |     ^~~~~~~~
/usr/include/c++/10/bits/stl_iterator.h:1501:5: note:   template argument deduction/substitution failed:
combo.cpp:41:34: note:   mismatched types 'const std::move_iterator<_IteratorL>' and 'char'
   41 |     for(int i=0;i<4;i++)if(v[i]!=ans)op+=v[i];
      |                                  ^~~
In file included from /usr/include/c++/10/string:41,
                 from /usr/include/c++/10/bits/locale_classes.h:40,
                 from /usr/include/c++/10/bits/ios_base.h:41,
                 from /usr/include/c++/10/ios:42,
                 from /usr/include/c++/10/ostream:38,
                 from /usr/include/c++/10/iostream:39,
                 from combo.cpp:1:
/usr/include/c++/10/bits/allocator.h:213:5: note: candidate: 'template<class _T1, class _T2> bool std::operator!=(const std::allocator<_CharT>&, const std::allocator<_T2>&)'
  213 |     operator!=(const allocator<_T1>&, const allocator<_T2>&)
      |     ^~~~~~~~
/usr/include/c++/10/bits/allocator.h:213:5: note:   template argument deduction/substitution failed:
combo.cpp:41:34: note:   mismatched types 'const std::allocator<_CharT>' and 'char'
   41 |     for(int i=0;i<4;i++)if(v[i]!=ans)op+=v[i];
      |                                  ^~~
In file included from /usr/include/c++/10/string:55,
                 from /usr/include/c++/10/bits/locale_classes.h:40,
                 from /usr/include/c++/10/bits/ios_base.h:41,
                 from /usr/include/c++/10/ios:42,
                 from /usr/include/c++/10/ostream:38,
                 from /usr/include/c++/10/iostream:39,
                 from combo.cpp:1:
/usr/include/c++/10/bits/basic_string.h:6229:5: note: candidate: 'template<class _CharT, class _Traits, class _Alloc> bool std::operator!=(const std::__cxx11::basic_string<_CharT, _Traits, _Alloc>&, const std::__cxx11::basic_string<_CharT, _Traits, _Alloc>&)'
 6229 |     operator!=(const basic_string<_CharT, _Traits, _Alloc>& __lhs,
      |     ^~~~~~~~
/usr/include/c++/10/bits/basic_string.h:6229:5: note:   template argument deduction/substitution failed:
combo.cpp:41:34: note:   mismatched types 'const std::__cxx11::basic_string<_CharT, _Traits, _Alloc>' and 'char'
   41 |     for(int i=0;i<4;i++)if(v[i]!=ans)op+=v[i];
      |                                  ^~~
In file included from /usr/include/c++/10/string:55,
                 from /usr/include/c++/10/bits/locale_classes.h:40,
                 from /usr/include/c++/10/bits/ios_base.h:41,
                 from /usr/include/c++/10/ios:42,
                 from /usr/include/c++/10/ostream:38,
                 from /usr/include/c++/10/iostream:39,
                 from combo.cpp:1:
/usr/include/c++/10/bits/basic_string.h:6242:5: note: candidate: 'template<class _CharT, class _Traits, class _Alloc> bool std::operator!=(const _CharT*, const std::__cxx11::basic_string<_CharT, _Traits, _Alloc>&)'
 6242 |     operator!=(const _CharT* __lhs,
      |     ^~~~~~~~
/usr/include/c++/10/bits/basic_string.h:6242:5: note:   template argument deduction/substitution failed:
combo.cpp:41:34: note:   mismatched types 'const _CharT*' and 'char'
   41 |     for(int i=0;i<4;i++)if(v[i]!=ans)op+=v[i];
      |                                  ^~~
In file included from /usr/include/c++/10/string:55,
                 from /usr/include/c++/10/bits/locale_classes.h:40,
                 from /usr/include/c++/10/bits/ios_base.h:41,
                 from /usr/include/c++/10/ios:42,
                 from /usr/include/c++/10/ostream:38,
                 from /usr/include/c++/10/iostream:39,
                 from combo.cpp:1:
/usr/include/c++/10/bits/basic_string.h:6254:5: note: candidate: 'template<class _CharT, class _Traits, class _Alloc> bool std::operator!=(const std::__cxx11::basic_string<_CharT, _Traits, _Alloc>&, const _CharT*)'
 6254 |     operator!=(const basic_string<_CharT, _Traits, _Alloc>& __lhs,
      |     ^~~~~~~~
/usr/include/c++/10/bits/basic_string.h:6254:5: note:   template argument deduction/substitution failed:
combo.cpp:41:34: note:   mismatched types 'const std::__cxx11::basic_string<_CharT, _Traits, _Alloc>' and 'char'
   41 |     for(int i=0;i<4;i++)if(v[i]!=ans)op+=v[i];
      |                                  ^~~
In file included from /usr/include/c++/10/bits/ios_base.h:46,
                 from /usr/include/c++/10/ios:42,
                 from /usr/include/c++/10/ostream:38,
                 from /usr/include/c++/10/iostream:39,
                 from combo.cpp:1:
/usr/include/c++/10/system_error:398:3: note: candidate: 'bool std::operator!=(const std::error_code&, const std::error_code&)'
  398 |   operator!=(const error_code& __lhs, const error_code& __rhs) noexcept
      |   ^~~~~~~~
/usr/include/c++/10/system_error:398:32: note:   no known conversion for argument 1 from 'char' to 'const std::error_code&'
  398 |   operator!=(const error_code& __lhs, const error_code& __rhs) noexcept
      |              ~~~~~~~~~~~~~~~~~~^~~~~
/usr/include/c++/10/system_error:404:3: note: candidate: 'bool std::operator!=(const std::error_code&, const std::error_condition&)'
  404 |   operator!=(const error_code& __lhs, const error_condition& __rhs) noexcept
      |   ^~~~~~~~
/usr/include/c++/10/system_error:404:32: note:   no known conversion for argument 1 from 'char' to 'const std::error_code&'
  404 |   operator!=(const error_code& __lhs, const error_condition& __rhs) noexcept
      |              ~~~~~~~~~~~~~~~~~~^~~~~
/usr/include/c++/10/system_error:410:3: note: candidate: 'bool std::operator!=(const std::error_condition&, const std::error_code&)'
  410 |   operator!=(const error_condition& __lhs, const error_code& __rhs) noexcept
      |   ^~~~~~~~
/usr/include/c++/10/system_error:410:37: note:   no known conversion for argument 1 from 'char' to 'const std::error_condition&'
  410 |   operator!=(const error_condition& __lhs, const error_code& __rhs) noexcept
      |              ~~~~~~~~~~~~~~~~~~~~~~~^~~~~
/usr/include/c++/10/system_error:415:3: note: candidate: 'bool std::operator!=(const std::error_condition&, const std::error_condition&)'
  415 |   operator!=(const error_condition& __lhs,
      |   ^~~~~~~~
/usr/include/c++/10/system_error:415:37: note:   no known conversion for argument 1 from 'char' to 'const std::error_condition&'
  415 |   operator!=(const error_condition& __lhs,
      |              ~~~~~~~~~~~~~~~~~~~~~~~^~~~~
In file included from /usr/include/c++/10/bits/locale_facets.h:48,
                 from /usr/include/c++/10/bits/basic_ios.h:37,
                 from /usr/include/c++/10/ios:44,
                 from /usr/include/c++/10/ostream:38,
                 from /usr/include/c++/10/iostream:39,
                 from combo.cpp:1:
/usr/include/c++/10/bits/streambuf_iterator.h:233:5: note: candidate: 'template<class _CharT, class _Traits> bool std::operator!=(const std::istreambuf_iterator<_CharT, _Traits>&, const std::istreambuf_iterator<_CharT, _Traits>&)'
  233 |     operator!=(const istreambuf_iterator<_CharT, _Traits>& __a,
      |     ^~~~~~~~
/usr/include/c++/10/bits/streambuf_iterator.h:233:5: note:   template argument deduction/substitution failed:
combo.cpp:41:34: note:   mismatched types 'const std::istreambuf_iterator<_CharT, _Traits>' and 'char'
   41 |     for(int i=0;i<4;i++)if(v[i]!=ans)op+=v[i];
      |                                  ^~~
In file included from /usr/include/c++/10/deque:67,
                 from /usr/include/c++/10/stack:60,
                 from combo.cpp:2:
/usr/include/c++/10/bits/stl_deque.h:2286:5: note: candidate: 'template<class _Tp, class _Alloc> bool std::operator!=(const std::deque<_Tp, _Alloc>&, const std::deque<_Tp, _Alloc>&)'
 2286 |     operator!=(const deque<_Tp, _Alloc>& __x, const deque<_Tp, _Alloc>& __y)
      |     ^~~~~~~~
/usr/include/c++/10/bits/stl_deque.h:2286:5: note:   template argument deduction/substitution failed:
combo.cpp:41:34: note:   mismatched types 'const std::deque<_Tp, _Alloc>' and 'char'
   41 |     for(int i=0;i<4;i++)if(v[i]!=ans)op+=v[i];
      |                                  ^~~
In file included from /usr/include/c++/10/stack:61,
                 from combo.cpp:2:
/usr/include/c++/10/bits/stl_stack.h:343:5: note: candidate: 'template<class _Tp, class _Seq> bool std::operator!=(const std::stack<_Tp, _Seq>&, const std::stack<_Tp, _Seq>&)'
  343 |     operator!=(const stack<_Tp, _Seq>& __x, const stack<_Tp, _Seq>& __y)
      |     ^~~~~~~~
/usr/include/c++/10/bits/stl_stack.h:343:5: note:   template argument deduction/substitution failed:
combo.cpp:41:34: note:   mismatched types 'const std::stack<_Tp, _Seq>' and 'char'
   41 |     for(int i=0;i<4;i++)if(v[i]!=ans)op+=v[i];
      |                                  ^~~
In file included from /usr/include/c++/10/tuple:39,
                 from /usr/include/c++/10/bits/stl_map.h:63,
                 from /usr/include/c++/10/map:61,
                 from combo.cpp:3:
/usr/include/c++/10/array:278:5: note: candidate: 'template<class _Tp, long unsigned int _Nm> bool std::operator!=(const std::array<_Tp, _Nm>&, const std::array<_Tp, _Nm>&)'
  278 |     operator!=(const array<_Tp, _Nm>& __one, const array<_Tp, _Nm>& __two)
      |     ^~~~~~~~
/usr/include/c++/10/array:278:5: note:   template argument deduction/substitution failed:
combo.cpp:41:34: note:   mismatched types 'const std::array<_Tp, _Nm>' and 'char'
   41 |     for(int i=0;i<4;i++)if(v[i]!=ans)op+=v[i];
      |                                  ^~~
In file included from /usr/include/c++/10/bits/stl_map.h:63,
                 from /usr/include/c++/10/map:61,
                 from combo.cpp:3:
/usr/include/c++/10/tuple:1448:5: note: candidate: 'template<class ... _TElements, class ... _UElements> constexpr bool std::operator!=(const std::tuple<_Tps ...>&, const std::tuple<_Args2 ...>&)'
 1448 |     operator!=(const tuple<_TElements...>& __t,
      |     ^~~~~~~~
/usr/include/c++/10/tuple:1448:5: note:   template argument deduction/substitution failed:
combo.cpp:41:34: note:   mismatched types 'const std::tuple<_Tps ...>' and 'char'
   41 |     for(int i=0;i<4;i++)if(v[i]!=ans)op+=v[i];
      |                                  ^~~
In file included from /usr/include/c++/10/map:61,
                 from combo.cpp:3:
/usr/include/c++/10/bits/stl_map.h:1508:5: note: candidate: 'template<class _Key, class _Tp, class _Compare, class _Alloc> bool std::operator!=(const std::map<_Key, _Tp, _Compare, _Alloc>&, const std::map<_Key, _Tp, _Compare, _Alloc>&)'
 1508 |     operator!=(const map<_Key, _Tp, _Compare, _Alloc>& __x,
      |     ^~~~~~~~
/usr/include/c++/10/bits/stl_map.h:1508:5: note:   template argument deduction/substitution failed:
combo.cpp:41:34: note:   mismatched types 'const std::map<_Key, _Tp, _Compare, _Alloc>' and 'char'
   41 |     for(int i=0;i<4;i++)if(v[i]!=ans)op+=v[i];
      |                                  ^~~
In file included from /usr/include/c++/10/map:62,
                 from combo.cpp:3:
/usr/include/c++/10/bits/stl_multimap.h:1173:5: note: candidate: 'template<class _Key, class _Tp, class _Compare, class _Alloc> bool std::operator!=(const std::multimap<_Key, _Tp, _Compare, _Alloc>&, const std::multimap<_Key, _Tp, _Compare, _Alloc>&)'
 1173 |     operator!=(const multimap<_Key, _Tp, _Compare, _Alloc>& __x,
      |     ^~~~~~~~
/usr/include/c++/10/bits/stl_multimap.h:1173:5: note:   template argument deduction/substitution failed:
combo.cpp:41:34: note:   mismatched types 'const std::multimap<_Key, _Tp, _Compare, _Alloc>' and 'char'
   41 |     for(int i=0;i<4;i++)if(v[i]!=ans)op+=v[i];
      |                                  ^~~
In file included from /usr/include/c++/10/vector:67,
                 from combo.cpp:4:
/usr/include/c++/10/bits/stl_vector.h:1937:5: note: candidate: 'template<class _Tp, class _Alloc> bool std::operator!=(const std::vector<_Tp, _Alloc>&, const std::vector<_Tp, _Alloc>&)'
 1937 |     operator!=(const vector<_Tp, _Alloc>& __x, const vector<_Tp, _Alloc>& __y)
      |     ^~~~~~~~
/usr/include/c++/10/bits/stl_vector.h:1937:5: note:   template argument deduction/substitution failed:
combo.cpp:41:34: note:   mismatched types 'const std::vector<_Tp, _Alloc>' and 'char'
   41 |     for(int i=0;i<4;i++)if(v[i]!=ans)op+=v[i];
      |                                  ^~~
In file included from /usr/include/c++/10/unordered_map:47,
                 from combo.cpp:6:
/usr/include/c++/10/bits/unordered_map.h:2097:5: note: candidate: 'template<class _Key, class _Tp, class _Hash, class _Pred, class _Alloc> bool std::operator!=(const std::unordered_map<_Key, _Tp, _Hash, _Pred, _Alloc>&, const std::unordered_map<_Key, _Tp, _Hash, _Pred, _Alloc>&)'
 2097 |     operator!=(const unordered_map<_Key, _Tp, _Hash, _Pred, _Alloc>& __x,
      |     ^~~~~~~~
/usr/include/c++/10/bits/unordered_map.h:2097:5: note:   template argument deduction/substitution failed:
combo.cpp:41:34: note:   mismatched types 'const std::unordered_map<_Key, _Tp, _Hash, _Pred, _Alloc>' and 'char'
   41 |     for(int i=0;i<4;i++)if(v[i]!=ans)op+=v[i];
      |                                  ^~~
In file included from /usr/include/c++/10/unordered_map:47,
                 from combo.cpp:6:
/usr/include/c++/10/bits/unordered_map.h:2111:5: note: candidat