Submission #160282

#TimeUsernameProblemLanguageResultExecution timeMemory
160282MarcoMendoza1Combo (IOI18_combo)C++14
5 / 100
1 ms200 KiB
#include <bits/stdc++.h> #include "combo.h" using namespace std; string r="",aux; char arr[4]; string guess_sequence(int n){ if(press("AB")){ arr[1]='X'; arr[3]='Y'; if(press("A")){ arr[2]='B'; r="A"; }else{ arr[2]='A'; r="B"; } }else{ arr[1]='A'; arr[2]='B'; if(press("X")){ arr[3]='Y'; r="X"; }else{ arr[3]='X'; r="Y"; } } int ax; while(r.size()<(n-1)){ aux=r+arr[2]+r+arr[1]+arr[1]+r+arr[1]+arr[2]+r+arr[1]+arr[3]; ax=press(aux); if(ax==r.size()){ r=r+arr[3]; }else if(ax==(r.size()+1)){ r=r+arr[2]; }else{ r=r+arr[1]; } } if(press(r+arr[1]+r+arr[2])==n){ if(press(r+arr[1])==n){ return r+arr[1]; }else{ return r+arr[2]; } }else{ return r+arr[3]; } }

Compilation message (stderr)

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