# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
152326 | nicolaalexandra | 콤보 (IOI18_combo) | C++14 | 0 ms | 0 KiB |
이 제출은 이전 버전의 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 guesss_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 = 2;
}}
/// acum determin cele 3 caractere pe care le mai am de pus
int ch1,ch2,ch3;
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;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];
}
return s;
}