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;
string guess_sequence(int n){
string ans = "";
string guess = "";
int ret;
vector<char> chars(3);
// adivino el primero
ret = press("AB");
if (ret>=1){
ret = press("A");
if(ret==1){
ans += 'A';
chars[0] = 'B';
}
else{
ans += 'B';
chars[0] = 'A';
}
chars[1] = 'X';
chars[2] = 'Y';
}
else{
chars[0] = 'A';
chars[1] = 'B';
ret = press("X");
if(ret==1){
ans += 'X';
chars[2] = 'Y';
}
else{
ans += 'Y';
chars[2] = 'X';
}
}
if(n==1) return ans;
// adivino el resto
for(int pos=2;pos<n;pos++){
guess = ans + chars[0] + ans + chars[1] + chars[0] + ans + chars[1] + chars[1] + ans + chars[1] + chars[2];
ret = press(guess);
if(ret==pos) ans += chars[0];
else if(ret==pos+1) ans += chars[1];
else ans += chars[2];
}
if(press(ans+chars[0])==n) ans += chars[0];
else if(press(ans+chars[1])==n) ans += chars[1];
else ans += chars[2];
return ans;
}
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |