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;
#define ll long long;
string guess_sequence(int N){
string s = "";
vector <string> s0(4);
s0[0] = "A";s0[1] = "B";s0[2] = "X";s0[3] = "Y";
vector <string> v(3);
int lenght = 1;
int pocetak = press("AB");
if(pocetak == 1){
pocetak = press("A");
if(pocetak == 1){
s += "A";
v[0] = "B";
v[1] = "X";
v[2] = "Y";
} else{
s += "B";
v[0] = "A";
v[1] = "X";
v[2] = "Y";
}
}else if(pocetak == 2){
s += "AB";
lenght = 2;
v[0] = "B";
v[1] = "X";
v[2] = "Y";
}else{
pocetak = press("X");
if(pocetak == 1){
s += "X";
v[0] = "A";
v[1] = "B";
v[2] = "Y";
}else{
s += "Y";
v[0] = "A";
v[1] = "B";
v[2] = "X";
}
}
string p;
while(lenght < N-1){
p = "";
p += s + v[0];
for (int j = 0; j < 3; ++j)
p += s + v[1] + v[j];
int k = press(p);
if(k == lenght){
s += v[2];
lenght++;
}else if(k == lenght + 1){
s += v[0];
lenght++;
}else if(k == lenght + 2){
s += v[1];
lenght++;
}
}
if((int)s.size() == N){
return s;
}
bool found = false;
for(int i = 0;i < 2;i++){
if(press(s+v[i]) > lenght){
s += v[i];
found = true;
break;
}
}
if(!found){
s+= v[2];
}
return s;
}
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |