# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
587837 | IvanJ | 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>
#define all(a) (a).begin(), (a).end()
using namespace std;
string guess_sequence(int n) {
string p = "", S = "";
if(press("A")) S = "A";
else if(press("B")) S = "B";
else if(press("X")) S = "X";
else S = "Y";
set<string> q;
q.insert("A"), q.insert("B"), q.insert("X"), q.insert("Y");
q.erase(S);
vector<string> v(all(q));
for(int i = 1;i < n - 1;i++) {
p "";
p += S + v[0];
for(int j = 0;j < 3;j++)
p += S + v[1] + v[j];
int x = press(p);
if(x == (int)S.size() + 1) S += v[0];
else if(x == (int)S.size() + 2) S += v[1];
else S += v[2];
}
if(press(S + v[0]) == n) S += v[0];
else if(press(S + v[1]) == n) S += v[1];
else S += v[2];
return S;
}