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;
/* run this program using the console pauser or add your own getch, system("pause") or input loop */
string guess_sequence(int n){
string p="";
int h=0,k=press(p+'A');
if((k-h)==1){h=h+1;p+='A';}
else{
k=press(p+'B');
if((k-h)==1){h=h+1;p+='B';}
else{
k=press(p+'X');
if((k-h)==1){h=h+1;p+='X';}
else{k+=1;h=h+1;p+='Y';}
}
}
char c=p[0];
vector<char> v={'A','B','X','Y'};vector<char> b;
for(int i=0;i<4;i++){
if(c!=v[i]){b.push_back(v[i]);}
}
while(k!=n){
k=press(p+b[0]);
if((k-h)==1){h=h+1;p+=b[0];}
else{
k=press(p+b[1]);
if((k-h)==1){h=h+1;p+=b[1];}
else{k+=1;h=h+1;p+=b[2];}
}
if(k==n)break;
}
return p;
}
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |