# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
232637 | pere_gil | 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 <iostream>
using namespace std;
std::string guess_sequence(int N){
string s="",rest="";
if(press("AB")>0){
if(press("A")>0){ s="A"; rest="BXY"; }
else{ s="B"; rest="AXY"; }
}
else{
if(press("X")>0){ s="X"; rest="ABY"; }
else{ s="Y"; rest="ABX"; }
}
int compl=1;
while(compl<N){
string supose=s+rest[0]+rest[0]+s+rest[0]+rest[1]+s+rest[0]+rest[2]+s+rest[1];
int a=press(supose);
if(a==compl+2){ s+=rest[0]; a++; }
else{
if(a==compl+1){ s+rest[1]; a++; }
else{ if(a==compl) { s+=rest[2]; a++; } }
}
}
return s;
}