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)
string s = "ABXY";
string guess_sequence(int N){
if(N == 1){
if(press("A")){
return "A";
}
else if(press("B")){
return "B";
}
else if(press("X")){
return "X";
}
else return "Y";
}
string ans;
if(press("AB")){
if(press("B")) swap(s[0], s[1]);
}
else{
if(press("X")) swap(s[0], s[2]);
else swap(s[0], s[3]);
}
ans = s[0];
while((int)ans.size() < N - 1){
string f = ans + s[1] + ans + s[2] + s[1] + ans + s[2] + s[2] + ans + s[2] + s[3];
int res = press(f);
if(res == (int)ans.size()){
ans += s[3];
}
else if(res == (int)ans.size() + 1){
ans += s[1];
}
else{
ans += s[2];
}
}
if(press(ans + s[1]) == N) ans += s[1];
else if(press(ans + s[2]) == N) ans += s[2];
else ans += s[3];
return ans;
}
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |