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;
//int press(string s){cout<<"press : ( "<<s.size()<<" , "<<s<<") : ";int r;cin>>r;return r;}
string guess_sequence(int n){
string s,c = "ABXY";
int f = 0;
for(int i = 0;i < 3;i++){
f = press(string(1,c[i]));
if(f){s += c[i];c.erase(i,1);break;}
}
if(!f){s += c.back();c.pop_back();}
for(int i = 1;i < n - 1;i++){
string p = s;
p += c[0];
string pp = s;pp += c[1];
for(int j = 0;j < 3;j++){p += pp;p += c[j];}
int r = press(p);
if(r == i + 1)s += c[0];
else if(r == i + 2)s += c[1];
else s += c[2];
}
if(n > 1){
if(press(s + string(1,c[0])) == n)s += c[0];
else if(press(s + string(1,c[1])) == n)s += c[1];
else s += c[2];
}
return s;
}
//int main(){int n;cin>>n;cout<<guess_sequence(n);return 0;}
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |