# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
89367 | jhnah917 | 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 "combo.h"
#include <vector>
using namespace std;
string guess_sequence(int N) {
string arr = "";
string key = "ABXY";
char c;
//i = 1
if(press("AB") > 0){
if(press("A") > 0) c = 'A';
else c = 'B';
}else if(press("X") > 0){
c = 'X';
}else c = 'Y';
for(auto i : key) if(i!=c) arr += i;
string s = c;
//2~N-1
for(int i=2; i<=N-1; i++){
string q = "";
q += s; q += arr[0]; q += arr[0];
q += s; q += arr[0]; q += arr[1];
q += s; q += arr[0]; q += arr[2];
q += s; q += arr[1]; q += s;
int val = press(q);
if(val == i-1) s += arr[2];
if(val == i) s += arr[1];
if(val == i+1) s += arr[0];
}
//N
if(press(s + arr[0]) == N) s += arr[0];
else if(press(s + arr[1]) == N) s += arr[1];
else s += arr[2];
return s;
}