# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
103627 | medk | Combo (IOI18_combo) | C++14 | 2 ms | 256 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 <bits/stdc++.h>
using namespace std;
#define ll long long
string guess_sequence(int N)
{
string ans="";
char ci[4]={'A','B','X','Y'};
char c[3];
if(press("AB")>0)
{
if(press("A")>0) ans="A";
else ans="B";
}
else
{
if(press("X")>0) ans="X";
else ans="Y";
}
int ind=0;
for(int i=0;i<4;i++)
{
if(ans[0]!=ci[i])
{
c[ind]=ci[i];
ind++;
}
}
for(int i=0;i<N-2;i++)
{
string pr=ans+c[0]+ans+c[1]+c[0]+ans+c[1]+c[1]+ans+c[1]+c[2];
int get=press(pr);
if(get==ans.length())
{
ans+=c[2];
}
else if(get==ans.length()+1)
{
ans+=c[0];
}
else
{
ans+=c[1];
}
}
if(press(ans+c[0])==N) ans+=c[0];
else if(press(ans+c[1])==N) ans+=c[1];
else ans+=c[2];
return ans;
}
Compilation message (stderr)
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |