# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
849541 | Bach21 | Combo (IOI18_combo) | C++14 | 18 ms | 1960 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 <bits/stdc++.h>
#include "combo.h"
using namespace std;
const int m=4;
string gue="ABXY";
string guess_sequence(int N) {
string s;
int tmp=press("AB");
if (tmp!=0)
{
tmp=press("A");
if (tmp!=0)
{
s+='A';
gue.erase(gue.begin());
} else
{
s+='B';
gue.erase(gue.begin()+1);
}
} else
{
tmp=press("X");
if (tmp!=0)
{
s+='X';
gue.erase(gue.begin()+2);
} else
{
s+='Y';
gue.erase(gue.begin()+3);
}
}
for (int i=0;i<N-2;i++)
{
string tmp="";
for (int j=0;j<gue.size();j++)
{
tmp+=s+gue[0]+gue[j];
}
tmp+=s+gue[1];
int len=press(tmp);
if (len==i+3)
{
s+=gue[0];
} else if (len==i+2)
{
s+=gue[1];
} else s+=gue[2];
}
if (N>1)
{
for (int i=0;i<gue.size()-1;i++)
{
string tmp=s;
tmp+=gue[i];
int len=press(tmp);
if (len==N)
{
s+=gue[i];
break;
}
if (i==gue.size()-2) s+=gue[gue.size()-1];
}
}
return s;
}
Compilation message (stderr)
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |