# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
591610 | Morisz10 | Combo (IOI18_combo) | C++14 | 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 <iostream>
#include <vector>
#include <string>
using namespace std;
string guess_sequence(int N) {
string chr = "ABXY";
int a = press("AB");
if (a) {
a = press("A");
if (!a)swap(chr[0], chr[1]);
}
else {
a = press("X");
if(a) swap(chr[0], chr[2]);
else swap(chr[0], chr[3]);
}
string s = "";
s += chr[0];
while (s.length() < N - 1) {
int x = press(s + chr[2] + s + chr[3] + chr[1] + s + chr[3] + chr[2] + s + chr[3] + chr[3]);
s += chr[x - s.length() + 1];
}
if (N == 1)return s;
if (press(s + chr[1]) == N)return s + chr[1];
if (press(s + chr[2]) == N)return s + chr[2];
return s + chr[3];
}
/*
int main()
{
}
*/