# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
1006656 | devariaota | 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 <bits/stdc++.h>
#include "combo.h"
using namespace std;
# define int long long
# define fir first
# define sec second
# define pb push_back
# define endl "\n"
std::string guess_sequence(int N) {
char ch[3];
string st;
int asd = press("AB");
if(asd) {
int x = press("A");
if(x) st = "A", ch = {'B', 'X', 'Y'};
else st = "B", ch = {'A', 'X', 'Y'};
}
else {
int x = press("X");
if(x) st = "X", ch = {'A', 'B', 'Y'};
else st = "Y", ch = {'A', 'B', 'X'};
}
for(int i = 2; i<N; i++) {
string now = "";
now += st; now.pb(ch[0]); now.pb(ch[0]);
now += st; now.pb(ch[0]); now.pb(ch[1]);
now += st; now.pb(ch[0]); now.pb(ch[2]);
now += st; now.pb(ch[1]);
int get = press(now);
if(get == i+1) st.pb(ch[0]);
else if(get == i) st.pb(ch[1]);
else st.pb(ch[2]);
}
string st0 = st; st0.pb(ch[0]);
string st1 = st; st1.pb(ch[1]);
string st2 = st; st2.pb(ch[2]);
int x = press(st0);
int y = press(st1);
int z = press(st2);
if(x == N) st.pb(ch[0]);
else if(y == N) st.pb(ch[1]);
else st.pb(ch[2]);
return st;
}