Submission #91506

#TimeUsernameProblemLanguageResultExecution timeMemory
91506javert2001Combo (IOI18_combo)C++14
100 / 100
46 ms552 KiB
#include<bits/stdc++.h> #include "combo.h" using namespace std; std::string guess_sequence(int N) { string ret; string manda; char uno; char dos; char tres; manda='A'; manda+='B'; if(press(manda)==0){ manda='X'; if(press(manda)==1){ ret='X'; uno = 'A'; dos = 'B'; tres = 'Y'; }else{ ret='Y'; uno = 'A'; dos = 'B'; tres = 'X'; } }else{ manda='A'; if(press(manda)==1){ ret='A'; uno = 'X'; dos = 'B'; tres = 'Y'; }else{ ret='B'; uno = 'A'; dos = 'X'; tres = 'Y'; } } if(N==1)return ret; for(int i=2;i<N;i++){ manda=ret; manda+=uno; manda+=ret; manda+=dos; manda+=uno; manda+=ret; manda+=dos; manda+=dos; manda+=ret; manda+=dos; manda+=tres; int act=press(manda); if(act==ret.size()){ ret+=tres; }else if(act==ret.size()+1){ ret+=uno; }else{ ret+=dos; } } manda=ret; manda+=uno; if(press(manda)==N){ ret+=uno; return ret; } manda=ret; manda+=dos; if(press(manda)==N){ ret+=dos; return ret; } ret+=tres; return ret; }

Compilation message (stderr)

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