Submission #869538

#TimeUsernameProblemLanguageResultExecution timeMemory
869538spetar76Combo (IOI18_combo)C++14
Compilation error
0 ms0 KiB
#include "combo.h" using namespace std; std::string guess_sequence(int N) { string S=""; string ne="QWE"; int qwqw=press("A"); if (qwqw>0){ S="A"; ne="BXY"; } else{ qwqw=press("B"); if (qwqw>0){ S="B"; ne="AXY"; } else{ qwqw=press("X"); if (qwqw>0){ S="X"; ne="ABY"; } else{ S="Y"; ne="ABX"; } } } if (N==1){return S;} else if (N==2){ if (press(S+ne[0])==2){return S+ne[0];} else if (press(S+ne[1])==2){return S+ne[1];} else{return S+ne[2];} } else if (N==3){ int g=press(S+ne[2]+ne[0] + S+ne[2]+ne[1] + S+2*ne[2] + S+ne[1]); if (g==2){ int g2=press(S+ne[2]+ne[2]); if (g2==2){return S+ne[2]+ne[2];} int g1=press(S+ne[2]+ne[1]); if (g1==2){return S+ne[2]+ne[1];} else{return S+ne[2]+ne[0];} } else if (g==1){ int g2=press(S+ne[1]+ne[2]); if (g2==2){return S+ne[1]+ne[2];} int g1=press(S+ne[1]+ne[1]); if (g1==2){return S+ne[1]+ne[1];} else{return S+ne[1]+ne[0];} } else{ int g2=press(S+ne[0]+ne[2]); if (g2==2){return S+ne[0]+ne[2];} int g1=press(S+ne[0]+ne[1]); if (g1==2){return S+ne[0]+ne[1];} else{return S+ne[0]+ne[0];} } } for (int i=2; i<N-1; ++i){ int g=press(S+ne[2]+ne[0] + S+ne[2]+ne[1] + S+2*ne[2] + S+ne[1]); S=S+ne[g-S.length()]; } int g=press(S+ne[2]+ne[0] + S+ne[2]+ne[1] + S+2*ne[2] + S+ne[1]); if (g==2){ int g2=press(S+ne[2]+ne[2]); if (g2==2){return S+ne[2]+ne[2];} int g1=press(S+ne[2]+ne[1]); if (g1==2){return S+ne[2]+ne[1];} else{return S+ne[2]+ne[0];} } else if (g==1){ int g2=press(S+ne[1]+ne[2]); if (g2==2){return S+ne[1]+ne[2];} int g1=press(S+ne[1]+ne[1]); if (g1==2){return S+ne[1]+ne[1];} else{return S+ne[1]+ne[0];} } else{ int g2=press(S+ne[0]+ne[2]); if (g2==2){return S+ne[0]+ne[2];} int g1=press(S+ne[0]+ne[1]); if (g1==2){return S+ne[0]+ne[1];} else{return S+ne[0]+ne[0];} } return S; }

Compilation message (stderr)

combo.cpp: In function 'std::string guess_sequence(int)':
combo.cpp:38:54: error: no match for 'operator+' (operand types are 'std::__cxx11::basic_string<char>' and 'int')
   38 |         int g=press(S+ne[2]+ne[0] + S+ne[2]+ne[1] + S+2*ne[2] + S+ne[1]);
      |                     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^
      |                                                   |
      |                                                   std::__cxx11::basic_string<char>
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/string:40,
                 from combo.h:3,
                 from combo.cpp:1:
/usr/include/c++/10/bits/stl_iterator.h:508:5: note: candidate: 'template<class _Iterator> std::reverse_iterator<_Iterator> std::operator+(typename std::reverse_iterator<_Iterator>::difference_type, const std::reverse_iterator<_Iterator>&)'
  508 |     operator+(typename reverse_iterator<_Iterator>::difference_type __n,
      |     ^~~~~~~~
/usr/include/c++/10/bits/stl_iterator.h:508:5: note:   template argument deduction/substitution failed:
combo.cpp:38:61: note:   mismatched types 'const std::reverse_iterator<_Iterator>' and 'int'
   38 |         int g=press(S+ne[2]+ne[0] + S+ne[2]+ne[1] + S+2*ne[2] + S+ne[1]);
      |                                                             ^
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/string:40,
                 from combo.h:3,
                 from combo.cpp:1:
/usr/include/c++/10/bits/stl_iterator.h:1540:5: note: candidate: 'template<class _Iterator> std::move_iterator<_IteratorL> std::operator+(typename std::move_iterator<_IteratorL>::difference_type, const std::move_iterator<_IteratorL>&)'
 1540 |     operator+(typename move_iterator<_Iterator>::difference_type __n,
      |     ^~~~~~~~
/usr/include/c++/10/bits/stl_iterator.h:1540:5: note:   template argument deduction/substitution failed:
combo.cpp:38:61: note:   mismatched types 'const std::move_iterator<_IteratorL>' and 'int'
   38 |         int g=press(S+ne[2]+ne[0] + S+ne[2]+ne[1] + S+2*ne[2] + S+ne[1]);
      |                                                             ^
In file included from /usr/include/c++/10/string:55,
                 from combo.h:3,
                 from combo.cpp:1:
/usr/include/c++/10/bits/basic_string.h:6022:5: note: candidate: 'template<class _CharT, class _Traits, class _Alloc> std::__cxx11::basic_string<_CharT, _Traits, _Alloc> std::operator+(const std::__cxx11::basic_string<_CharT, _Traits, _Alloc>&, const std::__cxx11::basic_string<_CharT, _Traits, _Alloc>&)'
 6022 |     operator+(const basic_string<_CharT, _Traits, _Alloc>& __lhs,
      |     ^~~~~~~~
/usr/include/c++/10/bits/basic_string.h:6022:5: note:   template argument deduction/substitution failed:
combo.cpp:38:61: note:   mismatched types 'const std::__cxx11::basic_string<_CharT, _Traits, _Alloc>' and 'int'
   38 |         int g=press(S+ne[2]+ne[0] + S+ne[2]+ne[1] + S+2*ne[2] + S+ne[1]);
      |                                                             ^
In file included from /usr/include/c++/10/string:56,
                 from combo.h:3,
                 from combo.cpp:1:
/usr/include/c++/10/bits/basic_string.tcc:1160:5: note: candidate: 'template<class _CharT, class _Traits, class _Alloc> std::__cxx11::basic_string<_CharT, _Traits, _Alloc> std::operator+(const _CharT*, const std::__cxx11::basic_string<_CharT, _Traits, _Alloc>&)'
 1160 |     operator+(const _CharT* __lhs,
      |     ^~~~~~~~
/usr/include/c++/10/bits/basic_string.tcc:1160:5: note:   template argument deduction/substitution failed:
combo.cpp:38:61: note:   mismatched types 'const _CharT*' and 'std::__cxx11::basic_string<char>'
   38 |         int g=press(S+ne[2]+ne[0] + S+ne[2]+ne[1] + S+2*ne[2] + S+ne[1]);
      |                                                             ^
In file included from /usr/include/c++/10/string:56,
                 from combo.h:3,
                 from combo.cpp:1:
/usr/include/c++/10/bits/basic_string.tcc:1180:5: note: candidate: 'template<class _CharT, class _Traits, class _Alloc> std::__cxx11::basic_string<_CharT, _Traits, _Alloc> std::operator+(_CharT, const std::__cxx11::basic_string<_CharT, _Traits, _Alloc>&)'
 1180 |     operator+(_CharT __lhs, const basic_string<_CharT, _Traits, _Alloc>& __rhs)
      |     ^~~~~~~~
/usr/include/c++/10/bits/basic_string.tcc:1180:5: note:   template argument deduction/substitution failed:
combo.cpp:38:61: note:   mismatched types 'const std::__cxx11::basic_string<_CharT, _Traits, _Alloc>' and 'int'
   38 |         int g=press(S+ne[2]+ne[0] + S+ne[2]+ne[1] + S+2*ne[2] + S+ne[1]);
      |                                                             ^
In file included from /usr/include/c++/10/string:55,
                 from combo.h:3,
                 from combo.cpp:1:
/usr/include/c++/10/bits/basic_string.h:6059:5: note: candidate: 'template<class _CharT, class _Traits, class _Alloc> std::__cxx11::basic_string<_CharT, _Traits, _Alloc> std::operator+(const std::__cxx11::basic_string<_CharT, _Traits, _Alloc>&, const _CharT*)'
 6059 |     operator+(const basic_string<_CharT, _Traits, _Alloc>& __lhs,
      |     ^~~~~~~~
/usr/include/c++/10/bits/basic_string.h:6059:5: note:   template argument deduction/substitution failed:
combo.cpp:38:61: note:   mismatched types 'const _CharT*' and 'int'
   38 |         int g=press(S+ne[2]+ne[0] + S+ne[2]+ne[1] + S+2*ne[2] + S+ne[1]);
      |                                                             ^
In file included from /usr/include/c++/10/string:55,
                 from combo.h:3,
                 from combo.cpp:1:
/usr/include/c++/10/bits/basic_string.h:6075:5: note: candidate: 'template<class _CharT, class _Traits, class _Alloc> std::__cxx11::basic_string<_CharT, _Traits, _Alloc> std::operator+(const std::__cxx11::basic_string<_CharT, _Traits, _Alloc>&, _CharT)'
 6075 |     operator+(const basic_string<_CharT, _Traits, _Alloc>& __lhs, _CharT __rhs)
      |     ^~~~~~~~
/usr/include/c++/10/bits/basic_string.h:6075:5: note:   template argument deduction/substitution failed:
combo.cpp:38:61: note:   deduced conflicting types for parameter '_CharT' ('char' and 'int')
   38 |         int g=press(S+ne[2]+ne[0] + S+ne[2]+ne[1] + S+2*ne[2] + S+ne[1]);
      |                                                             ^
In file included from /usr/include/c++/10/string:55,
                 from combo.h:3,
                 from combo.cpp:1:
/usr/include/c++/10/bits/basic_string.h:6087:5: note: candidate: 'template<class _CharT, class _Traits, class _Alloc> std::__cxx11::basic_string<_CharT, _Traits, _Alloc> std::operator+(std::__cxx11::basic_string<_CharT, _Traits, _Alloc>&&, const std::__cxx11::basic_string<_CharT, _Traits, _Alloc>&)'
 6087 |     operator+(basic_string<_CharT, _Traits, _Alloc>&& __lhs,
      |     ^~~~~~~~
/usr/include/c++/10/bits/basic_string.h:6087:5: note:   template argument deduction/substitution failed:
combo.cpp:38:61: note:   mismatched types 'const std::__cxx11::basic_string<_CharT, _Traits, _Alloc>' and 'int'
   38 |         int g=press(S+ne[2]+ne[0] + S+ne[2]+ne[1] + S+2*ne[2] + S+ne[1]);
      |                                                             ^
In file included from /usr/include/c++/10/string:55,
                 from combo.h:3,
                 from combo.cpp:1:
/usr/include/c++/10/bits/basic_string.h:6093:5: note: candidate: 'template<class _CharT, class _Traits, class _Alloc> std::__cxx11::basic_string<_CharT, _Traits, _Alloc> std::operator+(const std::__cxx11::basic_string<_CharT, _Traits, _Alloc>&, std::__cxx11::basic_string<_CharT, _Traits, _Alloc>&&)'
 6093 |     operator+(const basic_string<_CharT, _Traits, _Alloc>& __lhs,
      |     ^~~~~~~~
/usr/include/c++/10/bits/basic_string.h:6093:5: note:   template argument deduction/substitution failed:
combo.cpp:38:61: note:   mismatched types 'std::__cxx11::basic_string<_CharT, _Traits, _Alloc>' and 'int'
   38 |         int g=press(S+ne[2]+ne[0] + S+ne[2]+ne[1] + S+2*ne[2] + S+ne[1]);
      |                                                             ^
In file included from /usr/include/c++/10/string:55,
                 from combo.h:3,
                 from combo.cpp:1:
/usr/include/c++/10/bits/basic_string.h:6099:5: note: candidate: 'template<class _CharT, class _Traits, class _Alloc> std::__cxx11::basic_string<_CharT, _Traits, _Alloc> std::operator+(std::__cxx11::basic_string<_CharT, _Traits, _Alloc>&&, std::__cxx11::basic_string<_CharT, _Traits, _Alloc>&&)'
 6099 |     operator+(basic_string<_CharT, _Traits, _Alloc>&& __lhs,
      |     ^~~~~~~~
/usr/include/c++/10/bits/basic_string.h:6099:5: note:   template argument deduction/substitution failed:
combo.cpp:38:61: note:   mismatched types 'std::__cxx11::basic_string<_CharT, _Traits, _Alloc>' and 'int'
   38 |         int g=press(S+ne[2]+ne[0] + S+ne[2]+ne[1] + S+2*ne[2] + S+ne[1]);
      |                                                             ^
In file included from /usr/include/c++/10/string:55,
                 from combo.h:3,
                 from combo.cpp:1:
/usr/include/c++/10/bits/basic_string.h:6121:5: note: candidate: 'template<class _CharT, class _Traits, class _Alloc> std::__cxx11::basic_string<_CharT, _Traits, _Alloc> std::operator+(const _CharT*, std::__cxx11::basic_string<_CharT, _Traits, _Alloc>&&)'
 6121 |     operator+(const _CharT* __lhs,
      |     ^~~~~~~~
/usr/include/c++/10/bits/basic_string.h:6121:5: note:   template argument deduction/substitution failed:
combo.cpp:38:61: note:   mismatched types 'const _CharT*' and 'std::__cxx11::basic_string<char>'
   38 |         int g=press(S+ne[2]+ne[0] + S+ne[2]+ne[1] + S+2*ne[2] + S+ne[1]);
      |                                                             ^
In file included from /usr/include/c++/10/string:55,
                 from combo.h:3,
                 from combo.cpp:1:
/usr/include/c++/10/bits/basic_string.h:6127:5: note: candidate: 'template<class _CharT, class _Traits, class _Alloc> std::__cxx11::basic_string<_CharT, _Traits, _Alloc> std::operator+(_CharT, std::__cxx11::basic_string<_CharT, _Traits, _Alloc>&&)'
 6127 |     operator+(_CharT __lhs,
      |     ^~~~~~~~
/usr/include/c++/10/bits/basic_string.h:6127:5: note:   template argument deduction/substitution failed:
combo.cpp:38:61: note:   mismatched types 'std::__cxx11::basic_string<_CharT, _Traits, _Alloc>' and 'int'
   38 |         int g=press(S+ne[2]+ne[0] + S+ne[2]+ne[1] + S+2*ne[2] + S+ne[1]);
      |                                                             ^
In file included from /usr/include/c++/10/string:55,
                 from combo.h:3,
                 from combo.cpp:1:
/usr/include/c++/10/bits/basic_string.h:6133:5: note: candidate: 'template<class _CharT, class _Traits, class _Alloc> std::__cxx11::basic_string<_CharT, _Traits, _Alloc> std::operator+(std::__cxx11::basic_string<_CharT, _Traits, _Alloc>&&, const _CharT*)'
 6133 |     operator+(basic_string<_CharT, _Traits, _Alloc>&& __lhs,
      |     ^~~~~~~~
/usr/include/c++/10/bits/basic_string.h:6133:5: note:   template argument deduction/substitution failed:
combo.cpp:38:61: note:   mismatched types 'const _CharT*' and 'int'
   38 |         int g=press(S+ne[2]+ne[0] + S+ne[2]+ne[1] + S+2*ne[2] + S+ne[1]);
      |                                                             ^
In file included from /usr/include/c++/10/string:55,
                 from combo.h:3,
                 from combo.cpp:1:
/usr/include/c++/10/bits/basic_string.h:6139:5: note: candidate: 'template<class _CharT, class _Traits, class _Alloc> std::__cxx11::basic_string<_CharT, _Traits, _Alloc> std::operator+(std::__cxx11::basic_string<_CharT, _Traits, _Alloc>&&, _CharT)'
 6139 |     operator+(basic_string<_CharT, _Traits, _Alloc>&& __lhs,
      |     ^~~~~~~~
/usr/include/c++/10/bits/basic_string.h:6139:5: note:   template argument deduction/substitution failed:
combo.cpp:38:61: note:   deduced conflicting types for parameter '_CharT' ('char' and 'int')
   38 |         int g=press(S+ne[2]+ne[0] + S+ne[2]+ne[1] + S+2*ne[2] + S+ne[1]);
      |                                                             ^
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/string:40,
                 from combo.h:3,
                 from combo.cpp:1:
/usr/include/c++/10/bits/stl_iterator.h:1185:5: note: candidate: 'template<class _Iterator, class _Container> __gnu_cxx::__normal_iterator<_Iterator, _Container> __gnu_cxx::operator+(typename __gnu_cxx::__normal_iterator<_Iterator, _Container>::difference_type, const __gnu_cxx::__normal_iterator<_Iterator, _Container>&)'
 1185 |     operator+(typename __normal_iterator<_Iterator, _Container>::difference_type
      |     ^~~~~~~~
/usr/include/c++/10/bits/stl_iterator.h:1185:5: note:   template argument deduction/substitution failed:
combo.cpp:38:61: note:   mismatched types 'const __gnu_cxx::__normal_iterator<_Iterator, _Container>' and 'int'
   38 |         int g=press(S+ne[2]+ne[0] + S+ne[2]+ne[1] + S+2*ne[2] + S+ne[1]);
      |                                                             ^
combo.cpp:64:54: error: no match for 'operator+' (operand types are 'std::__cxx11::basic_string<char>' and 'int')
   64 |         int g=press(S+ne[2]+ne[0] + S+ne[2]+ne[1] + S+2*ne[2] + S+ne[1]);
      |                     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^
      |                                                   |
      |                                                   std::__cxx11::basic_string<char>
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/string:40,
                 from combo.h:3,
                 from combo.cpp:1:
/usr/include/c++/10/bits/stl_iterator.h:508:5: note: candidate: 'template<class _Iterator> std::reverse_iterator<_Iterator> std::operator+(typename std::reverse_iterator<_Iterator>::difference_type, const std::reverse_iterator<_Iterator>&)'
  508 |     operator+(typename reverse_iterator<_Iterator>::difference_type __n,
      |     ^~~~~~~~
/usr/include/c++/10/bits/stl_iterator.h:508:5: note:   template argument deduction/substitution failed:
combo.cpp:64:61: note:   mismatched types 'const std::reverse_iterator<_Iterator>' and 'int'
   64 |         int g=press(S+ne[2]+ne[0] + S+ne[2]+ne[1] + S+2*ne[2] + S+ne[1]);
      |                                                             ^
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/string:40,
                 from combo.h:3,
                 from combo.cpp:1:
/usr/include/c++/10/bits/stl_iterator.h:1540:5: note: candidate: 'template<class _Iterator> std::move_iterator<_IteratorL> std::operator+(typename std::move_iterator<_IteratorL>::difference_type, const std::move_iterator<_IteratorL>&)'
 1540 |     operator+(typename move_iterator<_Iterator>::difference_type __n,
      |     ^~~~~~~~
/usr/include/c++/10/bits/stl_iterator.h:1540:5: note:   template argument deduction/substitution failed:
combo.cpp:64:61: note:   mismatched types 'const std::move_iterator<_IteratorL>' and 'int'
   64 |         int g=press(S+ne[2]+ne[0] + S+ne[2]+ne[1] + S+2*ne[2] + S+ne[1]);
      |                                                             ^
In file included from /usr/include/c++/10/string:55,
                 from combo.h:3,
                 from combo.cpp:1:
/usr/include/c++/10/bits/basic_string.h:6022:5: note: candidate: 'template<class _CharT, class _Traits, class _Alloc> std::__cxx11::basic_string<_CharT, _Traits, _Alloc> std::operator+(const std::__cxx11::basic_string<_CharT, _Traits, _Alloc>&, const std::__cxx11::basic_string<_CharT, _Traits, _Alloc>&)'
 6022 |     operator+(const basic_string<_CharT, _Traits, _Alloc>& __lhs,
      |     ^~~~~~~~
/usr/include/c++/10/bits/basic_string.h:6022:5: note:   template argument deduction/substitution failed:
combo.cpp:64:61: note:   mismatched types 'const std::__cxx11::basic_string<_CharT, _Traits, _Alloc>' and 'int'
   64 |         int g=press(S+ne[2]+ne[0] + S+ne[2]+ne[1] + S+2*ne[2] + S+ne[1]);
      |                                                             ^
In file included from /usr/include/c++/10/string:56,
                 from combo.h:3,
                 from combo.cpp:1:
/usr/include/c++/10/bits/basic_string.tcc:1160:5: note: candidate: 'template<class _CharT, class _Traits, class _Alloc> std::__cxx11::basic_string<_CharT, _Traits, _Alloc> std::operator+(const _CharT*, const std::__cxx11::basic_string<_CharT, _Traits, _Alloc>&)'
 1160 |     operator+(const _CharT* __lhs,
      |     ^~~~~~~~
/usr/include/c++/10/bits/basic_string.tcc:1160:5: note:   template argument deduction/substitution failed:
combo.cpp:64:61: note:   mismatched types 'const _CharT*' and 'std::__cxx11::basic_string<char>'
   64 |         int g=press(S+ne[2]+ne[0] + S+ne[2]+ne[1] + S+2*ne[2] + S+ne[1]);
      |                                                             ^
In file included from /usr/include/c++/10/string:56,
                 from combo.h:3,
                 from combo.cpp:1:
/usr/include/c++/10/bits/basic_string.tcc:1180:5: note: candidate: 'template<class _CharT, class _Traits, class _Alloc> std::__cxx11::basic_string<_CharT, _Traits, _Alloc> std::operator+(_CharT, const std::__cxx11::basic_string<_CharT, _Traits, _Alloc>&)'
 1180 |     operator+(_CharT __lhs, const basic_string<_CharT, _Traits, _Alloc>& __rhs)
      |     ^~~~~~~~
/usr/include/c++/10/bits/basic_string.tcc:1180:5: note:   template argument deduction/substitution failed:
combo.cpp:64:61: note:   mismatched types '