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;
vector<string> c = {"A", "B", "X", "Y"};
string guess_sequence(int N) {
int first = -1;
if(press("AB")) {
if(press("A")) first = 0;
else first = 1;
} else if(press("X")) first = 2;
else first = 3;
string ans = c[first];
c.erase(c.begin() + first);
for(int i = 1; i < N - 1; i++) {
string s = ans+c[0]+c[0]+ans+c[0]+c[1]+ans+c[0]+c[2]+ans+c[1];
int x = press(s);
if(x == i + 2) ans += c[0];
else if(x == i+1) ans += c[1];
else ans += c[2];
}
if(N > 1) {
if(press(ans+c[0]) == N) ans += c[0];
else if(press(ans + c[1]) == N) ans += c[1] ;
else ans += c[2];
}
return ans;
}
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |