# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
1049269 | MrDogMeat | 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"
string guess_sequence(int N) {
string res = "";
vector<char> vec = {'A', 'B', 'X', 'Y'};
if(press("AB") >= 1) {
if(press("A") == 1) {
res += 'A';
vec.erase(vec.begin());
}
else {
res += 'B';
vec.erase(vec.begin() + 1);
}
}
else {
if(press("X") == 1) {
res += 'X';
vec.erase(vec.begin() + 2);
}
else {
res += 'Y';
vec.erase(vec.begin() + 3);
}
}
for(int i = 2; i < N; i++) {
string Try = res + vec[0] + res + vec[1] + vec[0] + res + vec[1] + vec[1] + res + vec[1] + vec[2];
int coins = press(Try);
if(coins == i) res += vec[0];
else if(coins == i + 1) res += vec[1];
else res += vec[2];
}
if(press(res + vec[0]) == N) res += vec[0];
else if(press(res + vec[1]) == N) res += vec[1];
else res += vec[2];
return res;
}