# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
544561 | LunaMeme | 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 <bits/stdc++.h>
using namespace std;
typedef pair<int, int> ii;
typedef vector<pair<int, int>> vii;
typedef vector<int> vi;
typedef long long ll;
#define PB push_back
#define MP make_pair
#define FOR(i, x, y) for (ll i = x; i < y ; i ++)
string guess_sequence(int n){
string s;
string l[] = {"A", "B", "X", "Y"};
string start;
vector<string> m;
FOR(i, 0, 4){
if (press(l[i])) s = l[i];
else m.PB(l[i]);
}
start = s;
int num = 1;
string check = start + m[0] + m[2] + start + m[1] + m[2];
while (num < n){
int guess = press(s + check);
if (guess == 0){
s += m[2];
num ++;
}
else if (guess == 1){
if (press(s + m[0])) s += m[0];
else s += m[1];
if (press(s + m[0])) s += m[0];
else s += m[1];
num += 2;
}
else{
if (press(s + m[0])) s += (m[0] + m[2]);
else s += (m[1] + m[2]);
num += 2;
}
}
return s;
}