# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
99895 | 1Khan | 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.
// In the name of GOD
#include "combo.h"
#include <bits/stdc++.h>
using namespace std;
#define nl '\n'
string guess_sequence(int n){
string s;
if(n == 1){
int p = press("A");
if(p){
s += 'A';
return s;
}
p = press("B");
if(p){
s += 'B';
return s;
}
p = press("X");
if(p){
s += 'x';
return s;
}
p = press("Y");
if(p){
s += 'y';
return s;
}
}
if(n == 2){
string k[111];
k[1] = "AB";
k[2] = "AX";
k[3] = "AY";
k[4] = "BX";
k[5] = "BY";
k[6] = "BA";
k[7] = "XA";
k[8] = "XY";
k[9] = "XB";
k[10] = "YA";
k[11] = "YB";
k[12] = "YX";
}
if(n == 3){
string k[] = { "ABX",
"ABY",
"ABB",
"AXY",
"AXB",
"AXX",
"AYX",
"AYB",
"AYY",
"BAX",
"BAY",
"BAA",
"BXA",
"BXY",
"BXX",
"BYA",
"BYX",
"BYY",
"XAB",
"XAY",
"XAA",
"XBA",
"XBY",
"XBB",
"XYA",
"XYB",
"XYY",
"YAB",
"YAX",
"YAA",
"YBA",
"YBX",
"YBB",
"YXA",
"YXB",
"YXX",
};
int w = 0;
for(int i = 0; ; ++i){
if(s[i].size() == 0){
break;
}
int val = press(k[i]);
w = max(w, val);
if(w == val){
s = k[i];
}
}
return s;
} else{
s += "ABXY";
return s;
}
}