Submission #1081255

#TimeUsernameProblemLanguageResultExecution timeMemory
1081255logangdCombo (IOI18_combo)C++14
100 / 100
26 ms1756 KiB
#include "combo.h" using namespace std; string guess_sequence(int N){ char c[3]; string s; int t=press("AB"); if(t){ t=press("A"); if(t)c[0]='B',c[1]='X',c[2]='Y',s+="A"; else c[0]='A',c[1]='X',c[2]='Y',s+="B"; }else{ t=press("X"); if(t)c[0]='B',c[1]='A',c[2]='Y',s+="X"; else c[0]='B',c[1]='X',c[2]='A',s+="Y"; } if(N==1)return s; while(s.size()<N-1){ t=press(s+c[0]+c[0]+s+c[0]+c[1]+s+c[0]+c[2]+s+c[1]); if(t==s.size()){ s+=c[2]; }else if(t==s.size()+1){ s+=c[1]; }else{ s+=c[0]; } } t=press(s+"A"+s+"B"); if(t==s.size()+1){ t=press(s+"A"); if(t==s.size()+1)s+="A"; else s+="B"; }else{ t=press(s+"X"); if(t==s.size()+1)s+="X"; else s+="Y"; } return s; }

Compilation message (stderr)

combo.cpp: In function 'std::string guess_sequence(int)':
combo.cpp:18:19: warning: comparison of integer expressions of different signedness: 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} and 'int' [-Wsign-compare]
   18 |     while(s.size()<N-1){
      |           ~~~~~~~~^~~~
combo.cpp:20:13: warning: comparison of integer expressions of different signedness: 'int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   20 |         if(t==s.size()){
      |            ~^~~~~~~~~~
combo.cpp:22:19: warning: comparison of integer expressions of different signedness: 'int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   22 |         }else if(t==s.size()+1){
      |                  ~^~~~~~~~~~~~
combo.cpp:29:9: warning: comparison of integer expressions of different signedness: 'int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   29 |     if(t==s.size()+1){
      |        ~^~~~~~~~~~~~
combo.cpp:31:13: warning: comparison of integer expressions of different signedness: 'int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   31 |         if(t==s.size()+1)s+="A";
      |            ~^~~~~~~~~~~~
combo.cpp:35:13: warning: comparison of integer expressions of different signedness: 'int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   35 |         if(t==s.size()+1)s+="X";
      |            ~^~~~~~~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...