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>
#define sz(a) (int)a.size()
#define all(a) a.begin(), a.end()
using namespace std;
string guess_sequence(signed N){
string start="A";
string p="AB";
int r=press(p);
if(r>=1){
p="A";
r=press(p);
if(r>=1) start="A";
else start="B";
}else {
p="X";
r=press(p);
if(r>=1) start="X";
else start="Y";
}
vector<string> others;
if(start!="A") others.push_back("A");
if(start!="B") others.push_back("B");
if(start!="X") others.push_back("X");
if(start!="Y") others.push_back("Y");
for (int i = 1; i < N-1; i++)
{
string tp="";
tp+=start+others[0];
for (int j = 0; j < 3; j++)
{
tp+=start+others[1]+others[j];
}
r=press(tp);
if(r<i+1){
start+=others[2];
}else if(r==i+1){
start+=others[0];
}else {
start+=others[1];
}
}
for (int i = 0; i < 2&&N>1; i++){
string tp=start;
tp+=others[i];
if(press(tp)==N) {
start+=others[i];
break;
}else if(i==1){
start+=others[i+1];
break;
}
}
return start;
}
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |