이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include <bits/stdc++.h>
#define pb push_back
#include "combo.h"
using namespace std;
string guess_sequence(int N) {
string p = "", ans = "";
vector<char> pos;
pos.pb('A');
pos.pb('B');
pos.pb('X');
pos.pb('Y');
int c;
p = "AB";
c = press(p);
if(c > 0){
p = "A";
c = press(p);
if(c > 0) ans = "A";
else ans = "B";
}
else{
p = "X";
c = press(p);
if(c > 0) ans = "X";
else ans = "Y";
}
if(N == 1){
return ans;
}
vector<char> other;
if(ans == "A"){
other.pb('B');
other.pb('X');
other.pb('Y');
}
if(ans == "B"){
other.pb('A');
other.pb('X');
other.pb('Y');
}
if(ans == "X"){
other.pb('B');
other.pb('A');
other.pb('Y');
}
if(ans == "Y"){
other.pb('B');
other.pb('X');
other.pb('A');
}
for(int i = 1; i <= N-2; i++){
//p += (ans + other[1]); // just add other[1]
//p += (ans + other[2] + other[0]);
//p += (ans + other[2] + other[1]);
//p += (ans + other[2] + other[2]);
p = ans + other[1] + ans + other[2] + other[0] + ans + other[2] + other[1] + ans + other[2] + other[2];
int len = press(p);
if(len == i) ans += other[0];
else if(len == i + 1){
ans += other[1];
}
else ans += other[2];
}
for(int i = N-1; i <= N-1; i++){
p = "";
//p += (ans + other[1]); // just add other[1]
//p += (ans + other[2] + other[0]);
//p += (ans + other[2] + other[1]);
//p += (ans + other[2] + other[2]);
p = ans + other[1] + ans + other[2];
int len = press(p);
if(len == i) ans += other[0];
else if(len == i + 1){
p = ans + other[1];
len = press(p);
if(len == i + 1) ans += other[1];
else ans += other[2];
}
}
/*
for(int i = 0; i < 2; i++){
p = ans + other[i];
c = press(p);
if(c == N){
ans += other[i];
break;
}
}
if(ans.size() < N) ans += other[2];
*/
return ans;
}
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |