# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
583087 | Mystic03 | 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 <vector>
#include <algorithm>
using namespace std;
std::string guess_sequence(int N) {
string p = "";
char c;
vector<char> possible{ 'A', 'B', 'X', 'Y' };
if (press("A")) {
p.push_back('A');
possible.erase(possible.begin() + 0);
}
else if (press("B")) {
p.push_back('B');
possible.erase(possible.begin() + 1);
}
else if (press("X")) {
p.push_back('X');
possible.erase(possible.begin() + 2);
}
else{
p.push_back('Y');
possible.erase(possible.begin() + 3);
}
for (int i = 1; i < N; i++) {
for (char c : possible) {
p.push_back(c);
if (press(p) > i) break;
p.pop_back();
}
}
return p;
}