Submission #571041

#TimeUsernameProblemLanguageResultExecution timeMemory
571041mihai145Combo (IOI18_combo)C++14
5 / 100
1 ms312 KiB
#include "combo.h" std::string guess_sequence(int N) { std::string p = ""; if(press("AB")==0) { if(press("X")==1) p+="X"; else p+="Y"; } else { if(press("A")==1) p+="A"; else p+="B"; } char v[3]={0}; if(p[0]=='A') { v[0]='B'; v[1]='X'; v[2]='Y'; } if(p[0]=='B') { v[0]='A'; v[1]='X'; v[2]='Y'; } if(p[0]=='X') { v[0]='B'; v[1]='A'; v[2]='Y'; } if(p[0]=='Y') { v[0]='B'; v[1]='X'; v[2]='A'; } for(int i=2;i<=N-1;i++) { int ans=press(p+v[0]+v[0]+p+v[0]+v[1]+p+v[0]+v[2]+p+v[1]); if(ans==p.size()) p+=v[2]; else if(ans==p.size()+1) p+=v[1]; else p+=v[0]; } if(press(p+v[0])==N-1) { if(press(p+v[1])==N) p+=v[1]; else p+=v[2]; } else p+=v[0]; return p; }

Compilation message (stderr)

combo.cpp: In function 'std::string guess_sequence(int)':
combo.cpp:48:15: warning: comparison of integer expressions of different signedness: 'int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   48 |         if(ans==p.size())
      |            ~~~^~~~~~~~~~
combo.cpp:51:19: warning: comparison of integer expressions of different signedness: 'int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   51 |             if(ans==p.size()+1)
      |                ~~~^~~~~~~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...