# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
685876 | grossly_overconfident | Combo (IOI18_combo) | C++17 | 0 ms | 0 KiB |
This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#include "combo.h"
#include <bits/stdc++.h>
using namespace std;
string guess_sequence(int N) {
vector<char> letter;
string result;
if (press("AB") != 0) {
if (press("A") == 1) {
result = "A";
letter = { 'B', 'X', 'Y' };
}
else {
result = "B";
letter = { 'A', 'X', 'Y' };
}
}
else {
if (press("X") == 1) {
result = "X";
letter = { 'B', 'A', 'Y' };
}
else {
result = "Y";
letter = { 'B', 'X', 'A' };
}
}
string result = f;
while (result.size() < N) {
if (result.size() == N - 1) {
if (press(result + letter[0]) > result.size()) {
result += letter[0];
}
else if (press(result + letter[1]) > result.size()) {
result += letter[1];
}
else {
result += letter[2];
}
}
else{
int outcome = press(result + letter[0] + letter[1] + result + letter[1] + letter[0]);
if (outcome == result.size()) {
result += letter[2];
}
else if (outcome == result.size() + 2) {
if (press(result + letter[0] + letter[1]) == result.size()) {
result += letter[1] + letter[0];
}
else {
result += letter[0] + letter[1];
}
}
else {
if (press(result + letter[0] + letter[2]) == result.size()) {
result += letter[1] + letter[2];
}
else {
result += letter[0] + letter[2];
}
}
}
}
return result;
}