이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include <iostream>
#include <cstring>
#include "combo.h"
using namespace std;
//string s(""), p("");
//int n;
/*int press (string p){ /// asta e query-ul
int sol;
cout<<"query "<<p<<endl;
cin>>sol;
return sol;
}*/
string guess_sequence (int n){
string s("");
string v("");
/// mai intai trb sa aflu primul caracter
string c("ABXY");
int first;
v += "AB";
if (press(v) == 0){ /// stiu clar ca e X sau Y
v.clear(); v = "X";
if (press(v)){ /// stiu sigur ca e X
s += "X";
first = 2;
} else {
s += "Y";
first = 3;
}
} else {
v.clear(); v = "A";
if (press(v)){
s += "A";
first = 0;
} else {
s += "B";
first = 1;
}}
if (n == 1)
return s;
/// acum determin cele 3 caractere pe care le mai am de pus
int ch1=0,ch2=0,ch3=0;
for (int j=0,pas=0;j<4;j++){
if (j == first)
continue;
pas++;
if (pas == 1) ch1 = j;
if (pas == 2) ch2 = j;
if (pas == 3) ch3 = j;
}
for (int i=1;i<n-1;i++){
v.clear();
v += s, v += c[ch1];
v += s, v += c[ch2], v += c[ch1];
v += s, v += c[ch2], v += c[ch2];
v += s, v += c[ch2], v += c[ch3];
int val = press (v);
if (val == i){
s += c[ch3];
continue;
}
if (val == i+1)
s += c[ch1];
else s += c[ch2];
}
/// trb sa fac separat pt ultimul pt ca depasesc 4*n;
v.clear();
v += s, v += c[ch1];
if (press(v) == n)
s += c[ch1];
else {
v.clear();
v += s, v += c[ch2];
if (press(v) == n)
s += c[ch2];
else s += c[ch3];
}
return s;
}
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |