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 <iostream>
#include "combo.h"
using namespace std;
string s;
string valasz;
int si, db;
int x, y;
char a='A', b='B', c='X';
/*
int press(string s) {
db++;
//cout.flush() << s << endl;
int maxi=0, p=s.size();
for (int i=0; i<p; i++) {
int db=0;
for (int j=i; j<min(p, i+si); j++) {
if (s[j]==valasz[j-i]) db++, maxi=max(maxi, db);
else break;
}
}
//cout << maxi << endl;
return maxi;
}
*/
string guess_sequence(int n) {
x=press("AB");
y=press("AX");
if (x && y) s+=a, a='Y';
if (x && !y) s+=b, b='Y';
if (!x && y) s+=c, c='Y';
if (!x && !y) s+='Y';
for (int i=1; i<n-1; i++) {
x=press(s+a+a+s+a+b+s+a+c+s+b);
if (x==i+2) s+=a;
if (x==i+1) s+=b;
if (x==i) s+=c;
}
if (n>1) {
x=press(s+a);
y=press(s+b);
if (x>y) s+=a;
if (y>x) s+=b;
if (x==y) s+=c;
}
return s;
}
/*
int main() {
cin >> valasz;
si=valasz.size();
cout << guess_sequence(si) << "\n";
cout << si << " " << db << endl;
return 0;
}
*/
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |