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;
char first;
int temp=press("AB");
if(temp>=1) {
if(temp==2) first='A';
else if(press("A")==1) first='A';
else first='B';
}
else {
if(press("X")) first='X';
else first='Y';
}
ans.push_back(first);
if(n==1) return ans;
vector<char> sus;
if(first!='A') sus.push_back('A');
if(first!='B') sus.push_back('B');
if(first!='X') sus.push_back('X');
if(first!='Y') sus.push_back('Y');
for(int i=1; i<n-1; ++i) {
int bruh=press(ans+sus[0]+sus[0]+ans+sus[0]+sus[1]+ans+sus[0]+sus[2]+ans+sus[1]);
if(bruh==i) {
ans.push_back(sus[2]);
}
else if(bruh==i+1) ans.push_back(sus[1]);
else ans.push_back(sus[0]);
}
if(press(ans+"A"+ans+"B")==n) {
if(press(ans+"A")==n) return ans+'A';
else return ans+'B';
}
else {
if(press(ans+"X")==n) return ans+'X';
else return ans+'Y';
}
return ans;
}
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |