Submission #534441

#TimeUsernameProblemLanguageResultExecution timeMemory
534441YaserFaisalCombo (IOI18_combo)C++14
Compilation error
0 ms0 KiB
#include <bits/stdc++.h> #include "combo.h" using namespace std; string call( string cur ) { if ( cur[0] == 'A' ) { if ( press(cur+'B') == cur.size()+1 ) return cur+'B' ; else if ( press(cur+'X') == cur.size()+1 ) return cur+'X' ; else return cur+'Y' ; } if ( cur[0] == 'B' ) { if ( press(cur+'A') == cur.size()+1 ) return cur+'A' ; else if ( press(cur+'X') == cur.size()+1 ) return cur+'X' ; else return cur+'Y' ; } if ( cur[0] == 'X' ) { if ( press(cur+'B') == cur.size()+1 ) return cur+'B' ; else if ( press(cur+'A') == cur.size()+1 ) return cur+'A' ; else return cur+'Y' ; } if ( cur[0] == 'Y' ) { if ( press(cur+'B') == cur.size()+1 ) return cur+'B' ; else if ( press(cur+'X') == cur.size()+1 ) return cur+'X' ; else return cur+'A' ; } } string guess_sequence (int n) { string cur = "" ; if ( press('A') == 1 ) cur+='A' ; else if ( press('B') == 1 ) cur+='B' ; else if ( press('X') == 1 ) cur+='X' ; else cur+='Y' ; while(cur.size()<n) cur = call(cur) ; return cur ; }

Compilation message (stderr)

combo.cpp: In function 'std::string call(std::string)':
combo.cpp:10:29: warning: comparison of integer expressions of different signedness: 'int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   10 |         if ( press(cur+'B') == cur.size()+1 ) return cur+'B' ;
      |              ~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~
combo.cpp:11:34: warning: comparison of integer expressions of different signedness: 'int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   11 |         else if ( press(cur+'X') == cur.size()+1 ) return cur+'X' ;
      |                   ~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~
combo.cpp:16:29: warning: comparison of integer expressions of different signedness: 'int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   16 |         if ( press(cur+'A') == cur.size()+1 ) return cur+'A' ;
      |              ~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~
combo.cpp:17:34: warning: comparison of integer expressions of different signedness: 'int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   17 |         else if ( press(cur+'X') == cur.size()+1 ) return cur+'X' ;
      |                   ~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~
combo.cpp:22:29: warning: comparison of integer expressions of different signedness: 'int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   22 |         if ( press(cur+'B') == cur.size()+1 ) return cur+'B' ;
      |              ~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~
combo.cpp:23:34: warning: comparison of integer expressions of different signedness: 'int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   23 |         else if ( press(cur+'A') == cur.size()+1 ) return cur+'A' ;
      |                   ~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~
combo.cpp:28:29: warning: comparison of integer expressions of different signedness: 'int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   28 |         if ( press(cur+'B') == cur.size()+1 ) return cur+'B' ;
      |              ~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~
combo.cpp:29:34: warning: comparison of integer expressions of different signedness: 'int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   29 |         else if ( press(cur+'X') == cur.size()+1 ) return cur+'X' ;
      |                   ~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~
combo.cpp: In function 'std::string guess_sequence(int)':
combo.cpp:37:16: error: could not convert ''A'' from 'char' to 'std::string' {aka 'std::__cxx11::basic_string<char>'}
   37 |     if ( press('A') == 1 ) cur+='A' ;
      |                ^~~
      |                |
      |                char
combo.cpp:38:21: error: could not convert ''B'' from 'char' to 'std::string' {aka 'std::__cxx11::basic_string<char>'}
   38 |     else if ( press('B') == 1 ) cur+='B' ;
      |                     ^~~
      |                     |
      |                     char
combo.cpp:39:21: error: could not convert ''X'' from 'char' to 'std::string' {aka 'std::__cxx11::basic_string<char>'}
   39 |     else if ( press('X') == 1 ) cur+='X' ;
      |                     ^~~
      |                     |
      |                     char
combo.cpp:41:21: warning: comparison of integer expressions of different signedness: 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} and 'int' [-Wsign-compare]
   41 |     while(cur.size()<n) cur = call(cur) ;
      |           ~~~~~~~~~~^~
combo.cpp: In function 'std::string call(std::string)':
combo.cpp:32:1: warning: control reaches end of non-void function [-Wreturn-type]
   32 | }
      | ^