Submission #570641

#TimeUsernameProblemLanguageResultExecution timeMemory
570641kkkkkkkkCombo (IOI18_combo)C++14
30 / 100
58 ms448 KiB
#include "combo.h" #include <iostream> using namespace std; string guess_sequence(int N) { string rez; char prva; if (press("AB")) { if (press("A")) rez="A",prva='A'; else rez="B",prva='B'; } else { if (press("X")) rez="X",prva='X'; else rez="Y",prva='Y'; } for (int i=1;i<N;i++) { if (prva=='A') { if (press(rez+"B")==rez.size()+1) rez+="B"; else if (press(rez+"X")==rez.size()+1) rez+="X"; else rez+="Y"; } else if (prva=='B') { if (press(rez+"A")==rez.size()+1) rez+="A"; else if (press(rez+"X")==rez.size()+1) rez+="X"; else rez+="Y"; } else if (prva=='X') { if (press(rez+"A")==rez.size()+1) rez+="A"; else if (press(rez+"B")==rez.size()+1) rez+="B"; else rez+="Y"; } else { if (press(rez+"A")==rez.size()+1) rez+="A"; else if (press(rez+"B")==rez.size()+1) rez+="B"; else rez+="X"; } } return rez; }

Compilation message (stderr)

combo.cpp: In function 'std::string guess_sequence(int)':
combo.cpp:28:31: 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(rez+"B")==rez.size()+1)
      |                 ~~~~~~~~~~~~~~^~~~~~~~~~~~~~
combo.cpp:30:36: warning: comparison of integer expressions of different signedness: 'int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   30 |             else if (press(rez+"X")==rez.size()+1)
      |                      ~~~~~~~~~~~~~~^~~~~~~~~~~~~~
combo.cpp:37:31: warning: comparison of integer expressions of different signedness: 'int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   37 |             if (press(rez+"A")==rez.size()+1)
      |                 ~~~~~~~~~~~~~~^~~~~~~~~~~~~~
combo.cpp:39:36: warning: comparison of integer expressions of different signedness: 'int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   39 |             else if (press(rez+"X")==rez.size()+1)
      |                      ~~~~~~~~~~~~~~^~~~~~~~~~~~~~
combo.cpp:46:31: warning: comparison of integer expressions of different signedness: 'int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   46 |             if (press(rez+"A")==rez.size()+1)
      |                 ~~~~~~~~~~~~~~^~~~~~~~~~~~~~
combo.cpp:48:36: warning: comparison of integer expressions of different signedness: 'int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   48 |             else if (press(rez+"B")==rez.size()+1)
      |                      ~~~~~~~~~~~~~~^~~~~~~~~~~~~~
combo.cpp:55:31: warning: comparison of integer expressions of different signedness: 'int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   55 |             if (press(rez+"A")==rez.size()+1)
      |                 ~~~~~~~~~~~~~~^~~~~~~~~~~~~~
combo.cpp:57:36: warning: comparison of integer expressions of different signedness: 'int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   57 |             else if (press(rez+"B")==rez.size()+1)
      |                      ~~~~~~~~~~~~~~^~~~~~~~~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...