# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
383759 | REALITYNB | Combo (IOI18_combo) | C++14 | 1 ms | 200 KiB |
This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#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=2;i<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){
ans+=BUTTONS[0];
}
else if(res>i){
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)
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |