이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include <bits/stdc++.h>
#include <combo.h>
using namespace std;
#define nl endl
// int press(string x){
// cout << x << endl;
// int n;
// cin >> n;
// return n;
// }
string t[] = {"A", "B", "X", "Y"};
string guess_sequence(int n){
string ret;
string f="";
if(press("AB")){
if(press("A")) f += "A";
else f+= "B";
}
else{
if(press("X")) f += "X";
else f+="Y";
}
vector<string> want;
for(int i = 0; i < 4; i++){
if(t[i] != f){
want.push_back(t[i]);
}
}
ret = f;
for(int i = 2; i < n; i++){
string query = "";
query += ret + want[0] + ret + want[1] + want[0] + ret + want[1] + want[2] + ret + want[1] + want[1] + ret + want[2];
int res = press(query);
if(res == (int)ret.size()) ret += want[2];
else if(res == (int)ret.size() + 1) ret += want[0];
else ret += want[1];
}
if(press(ret + want[0])==n) ret += want[0];
else if(press(ret + want[1]) == n) ret += want[1];
else ret += want[2];
return ret;
}
// int main(){
// guess_sequence(69);
//
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |