제출 #534526

#제출 시각아이디문제언어결과실행 시간메모리
534526YaserFaisal콤보 (IOI18_combo)C++17
컴파일 에러
0 ms0 KiB
#include <bits/stdc++.h> #include "combo.h" using namespace std; string call( string cur , int siz , int n ) { int x , y ; if ( siz == n-1 ) { if ( cur[0] == 'A' ) { x = press(cur+'B') ; y = press(cur+'X') ; if ( x == n ) return cur+'B' ; else if ( y == n ) return cur+'X' ; else return cur+'Y' ; } if ( cur[0] == 'B' ) { x = press(cur+'A') ; y = press(cur+'X') ; if ( x == n ) return cur+'A' ; else if ( y == n ) return cur+'X' ; else return cur+'Y' ; } if ( cur[0] == 'X' ) { x = press(cur+'B') ; y = press(cur+'A') ; if ( x == n ) return cur+'B' ; else if ( y == n ) return cur+'A' ; else return cur+'Y' ; } if ( cur[0] == 'Y' ) { x = press(cur+'B') ; y = press(cur+'X') ; if ( x == n ) return cur+'B' ; else if ( y == n ) return cur+'X' ; else return cur+'A' ; } } if ( cur[0] == 'A' ) { x = press(cur+'B'+cur+'XX'+cur+'XY'+cur+'XB') ; if ( x == siz+1 ) return cur+'B' ; else if ( x == siz+2 ) return cur+'X' ; else return cur+'Y' ; } if ( cur[0] == 'B' ) { x = press(cur+'A'+cur+'XX'+cur+'XY'+cur+'XA') ; if ( x == siz+1 ) return cur+'A' ; else if ( x == siz+2 ) return cur+'X' ; else return cur+'Y' ; } if ( cur[0] == 'X' ) { x = press(cur+'B'+cur+'AX'+cur+'AY'+cur+'AB') ; if ( x == siz+1 ) return cur+'B' ; else if ( x == siz+2 ) return cur+'A' ; else return cur+'Y' ; } if ( cur[0] == 'Y' ) { x = press(cur+'B'+cur+'XX'+cur+'XY'+cur+'XB') ; if ( x == siz+1 ) return cur+'B' ; else if ( x == siz+2 ) return cur+'X' ; else return cur+'A' ; } } string guess_sequence (int n) { for ( int i = 0 ; i <= 2000 ; i++ ) { } string cur = "" ; int x = press("AB") ; if ( x == 0 ) { if ( press(cur+'X') == 1 ) cur+='X' ; else cur+='Y' ; } else { if ( press(cur+'A') == 1 ) cur+='A' ; else cur+='B' ; } while(cur.size()<) cur = call(cur,cur.size(),n) ; return cur ; }

컴파일 시 표준 에러 (stderr) 메시지

combo.cpp:46:31: warning: multi-character character constant [-Wmultichar]
   46 |         x = press(cur+'B'+cur+'XX'+cur+'XY'+cur+'XB') ;
      |                               ^~~~
combo.cpp:46:40: warning: multi-character character constant [-Wmultichar]
   46 |         x = press(cur+'B'+cur+'XX'+cur+'XY'+cur+'XB') ;
      |                                        ^~~~
combo.cpp:46:49: warning: multi-character character constant [-Wmultichar]
   46 |         x = press(cur+'B'+cur+'XX'+cur+'XY'+cur+'XB') ;
      |                                                 ^~~~
combo.cpp:53:31: warning: multi-character character constant [-Wmultichar]
   53 |         x = press(cur+'A'+cur+'XX'+cur+'XY'+cur+'XA') ;
      |                               ^~~~
combo.cpp:53:40: warning: multi-character character constant [-Wmultichar]
   53 |         x = press(cur+'A'+cur+'XX'+cur+'XY'+cur+'XA') ;
      |                                        ^~~~
combo.cpp:53:49: warning: multi-character character constant [-Wmultichar]
   53 |         x = press(cur+'A'+cur+'XX'+cur+'XY'+cur+'XA') ;
      |                                                 ^~~~
combo.cpp:60:31: warning: multi-character character constant [-Wmultichar]
   60 |         x = press(cur+'B'+cur+'AX'+cur+'AY'+cur+'AB') ;
      |                               ^~~~
combo.cpp:60:40: warning: multi-character character constant [-Wmultichar]
   60 |         x = press(cur+'B'+cur+'AX'+cur+'AY'+cur+'AB') ;
      |                                        ^~~~
combo.cpp:60:49: warning: multi-character character constant [-Wmultichar]
   60 |         x = press(cur+'B'+cur+'AX'+cur+'AY'+cur+'AB') ;
      |                                                 ^~~~
combo.cpp:67:31: warning: multi-character character constant [-Wmultichar]
   67 |         x = press(cur+'B'+cur+'XX'+cur+'XY'+cur+'XB') ;
      |                               ^~~~
combo.cpp:67:40: warning: multi-character character constant [-Wmultichar]
   67 |         x = press(cur+'B'+cur+'XX'+cur+'XY'+cur+'XB') ;
      |                                        ^~~~
combo.cpp:67:49: warning: multi-character character constant [-Wmultichar]
   67 |         x = press(cur+'B'+cur+'XX'+cur+'XY'+cur+'XB') ;
      |                                                 ^~~~
combo.cpp: In function 'std::string call(std::string, int, int)':
combo.cpp:46:30: error: no match for 'operator+' (operand types are 'std::__cxx11::basic_string<char>' and 'int')
   46 |         x = press(cur+'B'+cur+'XX'+cur+'XY'+cur+'XB') ;
      |                   ~~~~~~~~~~~^~~~~
      |                          |    |
      |                          |    int
      |                          std::__cxx11::basic_string<char>
In file included from /usr/include/c++/10/bits/stl_algobase.h:67,
                 from /usr/include/c++/10/bits/specfun.h:45,
                 from /usr/include/c++/10/cmath:1927,
                 from /usr/include/x86_64-linux-gnu/c++/10/bits/stdc++.h:41,
                 from combo.cpp:1:
/usr/include/c++/10/bits/stl_iterator.h:508:5: note: candidate: 'template<class _Iterator> constexpr 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:46:31: note:   mismatched types 'const std::reverse_iterator<_Iterator>' and 'int'
   46 |         x = press(cur+'B'+cur+'XX'+cur+'XY'+cur+'XB') ;
      |                               ^~~~
In file included from /usr/include/c++/10/bits/stl_algobase.h:67,
                 from /usr/include/c++/10/bits/specfun.h:45,
                 from /usr/include/c++/10/cmath:1927,
                 from /usr/include/x86_64-linux-gnu/c++/10/bits/stdc++.h:41,
                 from combo.cpp:1:
/usr/include/c++/10/bits/stl_iterator.h:1540:5: note: candidate: 'template<class _Iterator> constexpr 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:46:31: note:   mismatched types 'const std::move_iterator<_IteratorL>' and 'int'
   46 |         x = press(cur+'B'+cur+'XX'+cur+'XY'+cur+'XB') ;
      |                               ^~~~
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/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 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, _Allocator> std::operator+(const std::__cxx11::basic_string<_CharT, _Traits, _Allocator>&, const std::__cxx11::basic_string<_CharT, _Traits, _Allocator>&)'
 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:46:31: note:   mismatched types 'const std::__cxx11::basic_string<_CharT, _Traits, _Allocator>' and 'int'
   46 |         x = press(cur+'B'+cur+'XX'+cur+'XY'+cur+'XB') ;
      |                               ^~~~
In file included from /usr/include/c++/10/string:56,
                 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/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 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, _Allocator> std::operator+(const _CharT*, const std::__cxx11::basic_string<_CharT, _Traits, _Allocator>&)'
 1160 |     operator+(const _CharT* __lhs,
      |     ^~~~~~~~
/usr/include/c++/10/bits/basic_string.tcc:1160:5: note:   template argument deduction/substitution failed:
combo.cpp:46:31: note:   mismatched types 'const _CharT*' and 'std::__cxx11::basic_string<char>'
   46 |         x = press(cur+'B'+cur+'XX'+cur+'XY'+cur+'XB') ;
      |                               ^~~~
In file included from /usr/include/c++/10/string:56,
                 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/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 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, _Allocator> std::operator+(_CharT, const std::__cxx11::basic_string<_CharT, _Traits, _Allocator>&)'
 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:46:31: note:   mismatched types 'const std::__cxx11::basic_string<_CharT, _Traits, _Allocator>' and 'int'
   46 |         x = press(cur+'B'+cur+'XX'+cur+'XY'+cur+'XB') ;
      |                               ^~~~
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/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 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, _Allocator> std::operator+(const std::__cxx11::basic_string<_CharT, _Traits, _Allocator>&, 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:46:31: note:   mismatched types 'const _CharT*' and 'int'
   46 |         x = press(cur+'B'+cur+'XX'+cur+'XY'+cur+'XB') ;
      |                               ^~~~
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/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 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, _Allocator> std::operator+(const std::__cxx11::basic_string<_CharT, _Traits, _Allocator>&, _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:46:31: note:   deduced conflicting types for parameter '_CharT' ('char' and 'int')
   46 |         x = press(cur+'B'+cur+'XX'+cur+'XY'+cur+'XB') ;
      |                               ^~~~
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/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 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, _Allocator> std::operator+(std::__cxx11::basic_string<_CharT, _Traits, _Allocator>&&, const std::__cxx11::basic_string<_CharT, _Traits, _Allocator>&)'
 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:46:31: note:   mismatched types 'const std::__cxx11::basic_string<_CharT, _Traits, _Allocator>' and 'int'
   46 |         x = press(cur+'B'+cur+'XX'+cur+'XY'+cur+'XB') ;
      |                               ^~~~
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/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 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, _Allocator> std::operator+(const std::__cxx11::basic_string<_CharT, _Traits, _Allocator>&, std::__cxx11::basic_string<_CharT, _Traits, _Allocator>&&)'
 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:46:31: note:   mismatched types 'std::__cxx11::basic_string<_CharT, _Traits, _Allocator>' and 'int'
   46 |         x = press(cur+'B'+cur+'XX'+cur+'XY'+cur+'XB') ;
      |                               ^~~~
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/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 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, _Allocator> std::operator+(std::__cxx11::basic_string<_CharT, _Traits, _Allocator>&&, std::__cxx11::basic_string<_CharT, _Traits, _Allocator>&&)'
 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:46:31: note:   mismatched types 'std::__cxx11::basic_string<_CharT, _Traits, _Allocator>' and 'int'
   46 |         x = press(cur+'B'+cur+'XX'+cur+'XY'+cur+'XB') ;
      |                               ^~~~
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/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 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, _Allocator> std::operator+(const _CharT*, std::__cxx11::basic_string<_CharT, _Traits, _Allocator>&&)'
 6121 |     operator+(const _CharT* __lhs,
      |     ^~~~~~~~
/usr/include/c++/10/bits/basic_string.h:6121:5: note:   template argument deduction/substitution failed:
combo.cpp:46:31: note:   mismatched types 'const _CharT*' and 'std::__cxx11::basic_string<char>'
   46 |         x = press(cur+'B'+cur+'XX'+cur+'XY'+cur+'XB') ;
      |                               ^~~~
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/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 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, _Allocator> std::operator+(_CharT, std::__cxx11::basic_string<_CharT, _Traits, _Allocator>&&)'
 6127 |     operator+(_CharT __lhs,
      |     ^~~~~~~~
/usr/include/c++/10/bits/basic_string.h:6127:5: note:   template argument deduction/substitution failed:
combo.cpp:46:31: note:   mismatched types 'std::__cxx11::basic_string<_CharT, _Traits, _Allocator>' and 'int'
   46 |         x = press(cur+'B'+cur+'XX'+cur+'XY'+cur+'XB') ;
      |                               ^~~~
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/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 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, _Allocator> std::operator+(std::__cxx11::basic_string<_CharT, _Traits, _Allocator>&&, 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:46:31: note:   mismatched types 'const _CharT*' and 'int'
   46 |         x = press(cur+'B'+cur+'XX'+cur+'XY'+cur+'XB') ;
      |                               ^~~~
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/istream:38,
                 from /usr/include/c++/10/sstream:38,
                 from /usr/include/c++/10/complex:45,
                 from /usr/include/c++/10/ccomplex:39,