# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
1066712 | Muhammad_Aneeq | 콤보 (IOI18_combo) | C++17 | 1 ms | 596 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;
char d[4]={'A','B','X','Y'};
map<string,int>vis;
int ask(string x)
{
if (vis.find(x)==vis.end())
vis[x]=press(x);
return vis[x];
}
string guess_sequence(int N)
{
srand(time(0));
string init="";
if (N==1)
{
for (int i=0;i<3;i++)
{
init+=d[i];
if (ask(init))
break;
init.pop_back();
}
if (init.size()==0)
init+=d[3];
return init;
}
string g="BXBYBAA";
if (ask(g)==1)
init+='A';
else if (ask(g)==0)
{
g="YAYBYXX";
if (ask(g)==2)
init+='X';
else
init+='X';
}
else
init+='B';
vector<int>c;
for (int i=0;i<4;i++)
{
if (init[0]==d[i])
continue;
c.push_back(d[i]);
}
for (int i=1;i<N;i++)
{
if (i!=N-1)
{
string z;
z+=init;
z+=c[0];
string g;
g+=init;
g+=c[1];
for (int j=0;j<3;j++)
z+=g,z+=c[j];
int sz=ask(z);
if (sz==i)
init+=c[2];
if (sz==i+1)
init+=c[0];
if (sz==i+2)
init+=c[1];
}
else
{
for (int j=0;j<2;j++)
{
init+=c[j];
if (ask(init)==i+1)
break;
init.pop_back();
}
if (init.size()==i)
init+=c[2];
}
}
return init;
}
Compilation message (stderr)
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |