Submission #383756

#TimeUsernameProblemLanguageResultExecution timeMemory
383756REALITYNBCombo (IOI18_combo)C++17
5 / 100
1 ms264 KiB
#include <bits/stdc++.h> #include "combo.h" using namespace std; string guess_sequence(int n){ string CH = "AB" ; int anss = press(CH) ; if(anss==0) CH="XY" ; char s ; string DUMB; DUMB+=CH[0] ; if(press(DUMB)) s=CH[0]; else s=CH[1]; string BUTTONS = "ABXY" ; for(int i=0;i<BUTTONS.size();i++){ if(BUTTONS[i]==s){ BUTTONS.erase(BUTTONS.begin()+i) ; break ; } }//YXXBA string ans ; ans+=s ; for(int i=1;i+1<n;i++){ string ask = ans; ask+=BUTTONS[0] ; for(int j=0;j<3;j++){ ask+=ans; ask+=BUTTONS[1]; ask+=BUTTONS[j]; } int res = press(ask) ; if(res==i+1){ ans+=BUTTONS[0]; } else if(res>i+1){ ans+=BUTTONS[1]; } else{ ans+=BUTTONS[2]; } } string ask ; ask=ans ; ask+=BUTTONS[0]; if(press(ask)==n){ return ask ; } ask.pop_back() ; ask+=BUTTONS[1] ; if(press(ask)==n){ return ask ; } ans+=BUTTONS[2]; return ans ; }

Compilation message (stderr)

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