Submission #1045484

#TimeUsernameProblemLanguageResultExecution timeMemory
1045484SiliconSquaredCombo (IOI18_combo)C++17
5 / 100
1 ms368 KiB
#include "combo.h" using namespace std; std::string guess_sequence(int n) { string z; int x; string a,b,c,d; if (press("AB")>0){ if (press("A")==1){ a="A";b="B"; }else{ a="B";b="A"; } c="X";d="Y"; }else{ if (press("X")==1){ a="X";b="Y"; }else{ a="Y";b="X"; } c="A";d="B"; } z=a; while (z.length()<n-1){ x=press(z+b+z+c+b+z+c+c+z+c+d); if (x==z.length()){ z+=d; }else if (x==z.length()+1){ z+=b; }else{ z+=c; } } if (press(z+b)==n){ return z+b; }else if (press(z+c)==n){ return z+c; }else{ return z+d; } }

Compilation message (stderr)

combo.cpp: In function 'std::string guess_sequence(int)':
combo.cpp:24:22: warning: comparison of integer expressions of different signedness: 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} and 'int' [-Wsign-compare]
   24 |     while (z.length()<n-1){
      |            ~~~~~~~~~~^~~~
combo.cpp:26:14: warning: comparison of integer expressions of different signedness: 'int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   26 |         if (x==z.length()){
      |             ~^~~~~~~~~~~~
combo.cpp:28:20: warning: comparison of integer expressions of different signedness: 'int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   28 |         }else if (x==z.length()+1){
      |                   ~^~~~~~~~~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...