# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
101643 | coldEr66 | 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>
#include "combo.h"
#define SZ(a) (int)a.size()
using namespace std;
int press(string p);
char pre(){
if (press("AB") > 0) {
if (press("A") > 0) return 'A';
return 'B';
}
else {
if (press("X") > 0) return 'X';
return 'Y';
}
}
string s="ABXY";
char ok[3];
string guess_sequence(int N){
string S = "";
S += pre();
int cnt = 0;
for (int i=0;i<4;i++) {
if (s[i] == S[0]) continue;
ok[cnt++] = s[i];
}
for (int i=1;i<N-1;i++) {
string tmp = S + ok[0];
for (int j=0;j<3;j++) tmp += (S + ok[1] + ok[j]);
int Q = press(tmp);
if (Q == SZ(s)) S += ok[2];
else if (Q == SZ(s)+1) S += ok[0];
else S += ok[1];
}
if (N > 1) {
for (int i=0;i<2;i++) {
if (press(S + ok[i]) == SZ(s) + 1) {
S += ok[i];
break;
}
}
if (SZ(s) < N) s += ok[2];
}
return S;
}
int main(){
}