이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include <string>
#include "combo.h"
#include <vector>
#include <deque>
using namespace std;
const int maxN = 2e3 + 10;
int ans[maxN];
string c;
vector<int> tmp;
string getStr(){
string s = "";
for(int x : tmp) s += c[x];
return s;
}
std::string guess_sequence(int N) {
int r;
c = "";
string current = "AB";
r = press(current);
if(r){
current = "A";
r = press(current);
if(r) c = "ABXY";
else c = "BAXY";
} else {
current = "Y";
r = press(current);
if(r) c = "YABX";
else c = "XABY";
}
for(int i = 1; i < N - 1; i++){
tmp.clear();
for(int j = 0; j < i; j++) tmp.push_back(ans[j]);
tmp.push_back(1);
for(int j = 0; j < i; j++) tmp.push_back(ans[j]);
tmp.push_back(2);
tmp.push_back(1);
for(int j = 0; j < i; j++) tmp.push_back(ans[j]);
tmp.push_back(2);
tmp.push_back(2);
for(int j = 0; j < i; j++) tmp.push_back(ans[j]);
tmp.push_back(2);
tmp.push_back(3);
r = press(getStr());
if(r == i) ans[i] = 3;
else if(r == i + 1) ans[i] = 1;
else ans[i] = 2;
}
if(N == 1){
tmp.push_back(0);
return getStr();
}
tmp.clear();
for(int j = 0; j < N - 1; j++) tmp.push_back(ans[j]);
tmp.push_back(1);
for(int j = 0; j < N - 1; j++) tmp.push_back(ans[j]);
tmp.push_back(2);
if(press(getStr()) == N){
tmp.clear();
for(int j = 0; j < N - 1; j++) tmp.push_back(ans[j]);
tmp.push_back(1);
if(press(getStr()) == N) return getStr();
tmp[N - 1] = 2;
return getStr();
}
tmp.clear();
for(int j = 0; j < N - 1; j++) tmp.push_back(ans[j]);
tmp.push_back(3);
return getStr();
}
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |