# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
1114549 | lftroq | 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"
using namespace std;
string guess_sequence(int N) {
string s="";
if(press("AB"))
{
if(press("A")) s.push_back('A');
else s.push_back('B');
}
else
{
if(press("X")) s.push_back('X');
else s.push_back('Y');
}
string can="ABXY";
if(s[0]=='A') can.erase(0,1);
else if(s[0]=='B') can.erase(1,1);
else if(s[0]=='X') can.erase(2,1);
else can.erase(3,1);
for(int i=1;i<n;i++)
{
string t=s;
t.push_back(can[0]);
t+=s;
t.push_back(can[1]);t.push_back(can[0]);
t+=s;
t.push_back(can[1]);t.push_back(can[1]);
t+=s;
t.push_back(can[1]);t.push_back(can[2]);
int c=press(t);
if(c==i) s.push_back(can[2]);
else if(c==i+1) s.push_back(can[0]);
else s.push_back(can[1]);
}
return s;
}