# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
1066738 | Muhammad_Aneeq | Combo (IOI18_combo) | C++17 | 45 ms | 11912 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="";
string g="AB",y="AX";
if (ask(g)&&ask(y))
init+='A';
if (ask(g)&&!ask(y))
init+='B';
if (!ask(g)&&ask(y))
init+='X';
if (!ask(g)&&!ask(y))
init+='Y';
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... |