Submission #992141

#TimeUsernameProblemLanguageResultExecution timeMemory
992141spycoderytCombo (IOI18_combo)C++17
Compilation error
0 ms0 KiB
#include "combo.h" using namespace std; std::string guess_sequence(int N) { vector<char> v = {'A','B','X','Y'}; string p = "",tmp,cur=0; for(int i = 0;i<N;i++) { int ch = 0; for(int k = 0;k<4;k++) { tmp = p + v[k]; int res = press(tmp); if(res>cur){ cur = res; p = tmp; ch = 1; break; } } if(!ch)return p; } return S; }

Compilation message (stderr)

combo.cpp: In function 'std::string guess_sequence(int)':
combo.cpp:4:3: error: 'vector' was not declared in this scope
    4 |   vector<char> v = {'A','B','X','Y'};
      |   ^~~~~~
combo.cpp:2:1: note: 'std::vector' is defined in header '<vector>'; did you forget to '#include <vector>'?
    1 | #include "combo.h"
  +++ |+#include <vector>
    2 | using namespace std;
combo.cpp:4:10: error: expected primary-expression before 'char'
    4 |   vector<char> v = {'A','B','X','Y'};
      |          ^~~~
combo.cpp:9:17: error: 'v' was not declared in this scope
    9 |       tmp = p + v[k];
      |                 ^
combo.cpp:11:13: error: no match for 'operator>' (operand types are 'int' and 'std::string' {aka 'std::__cxx11::basic_string<char>'})
   11 |       if(res>cur){
      |          ~~~^~~~
      |          |   |
      |          int std::string {aka std::__cxx11::basic_string<char>}
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/string:40,
                 from combo.h:3,
                 from combo.cpp:1:
/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:
combo.cpp:11:14: note:   mismatched types 'const std::pair<_T1, _T2>' and 'int'
   11 |       if(res>cur){
      |              ^~~
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:378:5: note: candidate: 'template<class _Iterator> constexpr 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:
combo.cpp:11:14: note:   mismatched types 'const std::reverse_iterator<_Iterator>' and 'int'
   11 |       if(res>cur){
      |              ^~~
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:416:5: note: candidate: 'template<class _IteratorL, class _IteratorR> constexpr 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:
combo.cpp:11:14: note:   mismatched types 'const std::reverse_iterator<_Iterator>' and 'int'
   11 |       if(res>cur){
      |              ^~~
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:1469:5: note: candidate: 'template<class _IteratorL, class _IteratorR> constexpr 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:
combo.cpp:11:14: note:   mismatched types 'const std::move_iterator<_IteratorL>' and 'int'
   11 |       if(res>cur){
      |              ^~~
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:1519:5: note: candidate: 'template<class _Iterator> constexpr 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:
combo.cpp:11:14: note:   mismatched types 'const std::move_iterator<_IteratorL>' and 'int'
   11 |       if(res>cur){
      |              ^~~
In file included from /usr/include/c++/10/bits/basic_string.h:48,
                 from /usr/include/c++/10/string:55,
                 from combo.h:3,
                 from combo.cpp:1:
/usr/include/c++/10/string_view:563:5: note: candidate: 'template<class _CharT, class _Traits> constexpr bool std::operator>(std::basic_string_view<_CharT, _Traits>, std::basic_string_view<_CharT, _Traits>)'
  563 |     operator> (basic_string_view<_CharT, _Traits> __x,
      |     ^~~~~~~~
/usr/include/c++/10/string_view:563:5: note:   template argument deduction/substitution failed:
combo.cpp:11:14: note:   mismatched types 'std::basic_string_view<_CharT, _Traits>' and 'int'
   11 |       if(res>cur){
      |              ^~~
In file included from /usr/include/c++/10/bits/basic_string.h:48,
                 from /usr/include/c++/10/string:55,
                 from combo.h:3,
                 from combo.cpp:1:
/usr/include/c++/10/string_view:569:5: note: candidate: 'template<class _CharT, class _Traits> constexpr bool std::operator>(std::basic_string_view<_CharT, _Traits>, std::__type_identity_t<std::basic_string_view<_CharT, _Traits> >)'
  569 |     operator> (basic_string_view<_CharT, _Traits> __x,
      |     ^~~~~~~~
/usr/include/c++/10/string_view:569:5: note:   template argument deduction/substitution failed:
combo.cpp:11:14: note:   mismatched types 'std::basic_string_view<_CharT, _Traits>' and 'int'
   11 |       if(res>cur){
      |              ^~~
In file included from /usr/include/c++/10/bits/basic_string.h:48,
                 from /usr/include/c++/10/string:55,
                 from combo.h:3,
                 from combo.cpp:1:
/usr/include/c++/10/string_view:576:5: note: candidate: 'template<class _CharT, class _Traits> constexpr bool std::operator>(std::__type_identity_t<std::basic_string_view<_CharT, _Traits> >, std::basic_string_view<_CharT, _Traits>)'
  576 |     operator> (__type_identity_t<basic_string_view<_CharT, _Traits>> __x,
      |     ^~~~~~~~
/usr/include/c++/10/string_view:576:5: note:   template argument deduction/substitution failed:
combo.cpp:11:14: note:   'std::__cxx11::basic_string<char>' is not derived from 'std::basic_string_view<_CharT, _Traits>'
   11 |       if(res>cur){
      |              ^~~
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:6305:5: note: candidate: 'template<class _CharT, class _Traits, class _Alloc> bool std::operator>(const std::__cxx11::basic_string<_CharT, _Traits, _Allocator>&, const std::__cxx11::basic_string<_CharT, _Traits, _Allocator>&)'
 6305 |     operator>(const basic_string<_CharT, _Traits, _Alloc>& __lhs,
      |     ^~~~~~~~
/usr/include/c++/10/bits/basic_string.h:6305:5: note:   template argument deduction/substitution failed:
combo.cpp:11:14: note:   mismatched types 'const std::__cxx11::basic_string<_CharT, _Traits, _Allocator>' and 'int'
   11 |       if(res>cur){
      |              ^~~
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:6318:5: note: candidate: 'template<class _CharT, class _Traits, class _Alloc> bool std::operator>(const std::__cxx11::basic_string<_CharT, _Traits, _Allocator>&, const _CharT*)'
 6318 |     operator>(const basic_string<_CharT, _Traits, _Alloc>& __lhs,
      |     ^~~~~~~~
/usr/include/c++/10/bits/basic_string.h:6318:5: note:   template argument deduction/substitution failed:
combo.cpp:11:14: note:   mismatched types 'const std::__cxx11::basic_string<_CharT, _Traits, _Allocator>' and 'int'
   11 |       if(res>cur){
      |              ^~~
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:6330:5: note: candidate: 'template<class _CharT, class _Traits, class _Alloc> bool std::operator>(const _CharT*, const std::__cxx11::basic_string<_CharT, _Traits, _Allocator>&)'
 6330 |     operator>(const _CharT* __lhs,
      |     ^~~~~~~~
/usr/include/c++/10/bits/basic_string.h:6330:5: note:   template argument deduction/substitution failed:
combo.cpp:11:14: note:   mismatched types 'const _CharT*' and 'int'
   11 |       if(res>cur){
      |              ^~~
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:1111:5: note: candidate: 'template<class _IteratorL, class _IteratorR, class _Container> bool __gnu_cxx::operator>(const __gnu_cxx::__normal_iterator<_IteratorL, _Container>&, const __gnu_cxx::__normal_iterator<_IteratorR, _Container>&)'
 1111 |     operator>(const __normal_iterator<_IteratorL, _Container>& __lhs,
      |     ^~~~~~~~
/usr/include/c++/10/bits/stl_iterator.h:1111:5: note:   template argument deduction/substitution failed:
combo.cpp:11:14: note:   mismatched types 'const __gnu_cxx::__normal_iterator<_IteratorL, _Container>' and 'int'
   11 |       if(res>cur){
      |              ^~~
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:1119:5: note: candidate: 'template<class _Iterator, class _Container> bool __gnu_cxx::operator>(const __gnu_cxx::__normal_iterator<_Iterator, _Container>&, const __gnu_cxx::__normal_iterator<_Iterator, _Container>&)'
 1119 |     operator>(const __normal_iterator<_Iterator, _Container>& __lhs,
      |     ^~~~~~~~
/usr/include/c++/10/bits/stl_iterator.h:1119:5: note:   template argument deduction/substitution failed:
combo.cpp:11:14: note:   mismatched types 'const __gnu_cxx::__normal_iterator<_Iterator, _Container>' and 'int'
   11 |       if(res>cur){
      |              ^~~
combo.cpp:20:10: error: 'S' was not declared in this scope
   20 |   return S;
      |          ^