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 cadena_actual = "";
vector<char>lista = {'A', 'B', 'X', 'Y'};
string crear_string(){
string devolver_str = "";
auto default1 = lista[2];
auto default2 = lista[1];
for (auto e: lista){
devolver_str+=cadena_actual;
devolver_str+=default1;
devolver_str+=e;
}
devolver_str+=cadena_actual;
devolver_str+=default2;
return devolver_str;
}
string guess_sequence(int N) {
/*
// CREAR SEPARADOR FORMA MALA
int var = lista[0]; // A
for (int i = 1; i<4; i++){
string x = "";
x+=lista[i];
if (press(x)==1){
var = lista[i];
lista.erase(lista.begin()+i);
break;
} if(i==3){
lista.erase(lista.begin()+0);
}
}
cadena_actual+=var;
*/
// CREAR SEPARADOR FORMA BUENA
int mn = 0; int mx = 3;
int mid = (mn+mx)/2;
int var;
while (mn<mx){
mid = (mn+mx)/2;
string norisitas = "";
for (int i = mn; i<=mid; i++){
norisitas+=lista[i];
}
if (press(norisitas)>=1){
mx = mid;
} else{
mn = mid+1;
}
}
var = lista[mn]; // si pongo mx no afecta porque quedaron en lo mismo
lista.erase(lista.begin()+mn);
cadena_actual+=var;
// if press de lisrta de 0 a mid es >=1, elimino de mid a max
// else elimino de mid a 0
// if press de primer elemento d elo que tengo es 1, bien sino paila
// CREAR STRING
if (N>1){
for (int i = 0; i<(N-2); i++){
var = press(crear_string());
int coso = cadena_actual.size();
cadena_actual+=lista[var-coso]; // CONSEJO: NO RESTAR VAINAS.SIZE
}
string h = cadena_actual; h+=lista[0];
if (press(h)==N){
cadena_actual+=lista[0];
} else{
h.pop_back();
h+=lista[1];
if (press(h)==N){
cadena_actual+=lista[1];
} else{
h.pop_back();
cadena_actual+=lista[2];
}
}
}
return cadena_actual;
}
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |