이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include "combo.h"
#include <bits/stdc++.h>
using namespace std;
string let = "ABXY";
string pos[2100];
string guess_sequence(int n) {
char first;
string ans = "";
string ask1;
ask1.push_back(let[0]);
ask1.push_back(let[1]);
if(press(ask1) != 0) {
string ask2; ask2.push_back(let[0]);
if(press(ask2) != 0) {
first = let[0];
} else {
first = let[1];
}
} else {
string ask2; ask2.push_back(let[2]);
if(press(ask2) != 0) {
first = let[2];
} else {
first = let[3];
}
}
string nwLet = "";
for(auto it : let) {
if(it != first) {
nwLet.push_back(it);
}
}
let = nwLet;
ans = first;
for(int i = 1; i < n - 1; i ++) {
string ask2 = "";
ask2 += ans;
ask2.push_back(let[0]);
ask2.push_back(let[0]);
ask2 += ans;
ask2.push_back(let[0]);
ask2.push_back(let[1]);
ask2 += ans;
ask2.push_back(let[0]);
ask2.push_back(let[2]);
ask2 += ans;
ask2.push_back(let[1]);
int curr = press(ask2);
if(curr == i) {
ans += let[2];
} else if(curr == i + 1) {
ans += let[1];
} else {
ans += let[0];
}
}
if(n == 1) {
return ans;
}
string ask3 = "";
ask3 += ans;
ask3.push_back(let[0]);
ask3 += ans;
ask3.push_back(let[1]);
if(press(ask3) == n) {
ask3 = ans;
ask3.push_back(let[0]);
if(press(ask3) == n) {
ans.push_back(let[0]);
} else {
ans.push_back(let[1]);
}
} else {
ans.push_back(let[2]);
}
return ans;
}
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |