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 "combo.h"
#include<bits/stdc++.h>
using namespace std;
string guess_sequence(int n) {
string ans = "";
string p = "";
if(press("AB") > 0) {
if(press("A") > 0) {
ans = "A";
}
else {
ans = "B";
}
}
else {
if(press("X") > 0) {
ans = "X";
}
else {
ans = "Y";
}
}
char buk[4] = {'A','B','X','Y'};
vector<char> bruh(0);
for(int i = 0; i < 4; i++) {
if(buk[i] != ans[0]) {
bruh.push_back(buk[i]);
}
}
for(int i = 1; i < n-1; i++) {
p = "";
p+=ans;
p+=bruh[0];
p+=ans;
p+=bruh[1];
p+=bruh[0];
p+=ans;
p+=bruh[1];
p+=bruh[1];
p+=ans;
p+=bruh[1];
p+=bruh[2];
int c = press(p);
if(c == i) {
ans+=bruh[2];
}
else if(c == i+1) {
ans+=bruh[0];
}
else {
ans+=bruh[1];
}
}
if(n > 1) {
if(press(ans+bruh[0]) == n) {
ans+=bruh[0];
}
else if(press(ans+bruh[1]) == n) {
ans+=bruh[1];
}
else {
ans+=bruh[2];
}
}
return ans;
}
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |