# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
719430 | AndrijaM | Combo (IOI18_combo) | C++14 | 1 ms | 208 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 ll=long long;
using namespace std;
string guess_sequence(int n)
{
vector<string>v;
v.push_back("A");
v.push_back("B");
v.push_back("X");
v.push_back("Y");
string ans="";
bool ok=false;
string c="";
if(!ok && press("A")==1)
{
ok=true;
v.erase(v.begin()+0);
c="A";
ans+="A";
}
if(!ok && press("B")==1)
{
ok=true;
v.erase(v.begin()+1);
c="B";
ans+="B";
}
if(!ok && press("X")==1)
{
ok=true;
c="X";
v.erase(v.begin()+2);
ans+="X";
}
if(!ok && press("Y")==1)
{
ok=true;
c="Y";
v.erase(v.begin()+3);
ans+="Y";
}
int k=1;
while(true)
{
string nstr="";
nstr+=ans+v[0]+ans+v[1]+v[0]+ans+v[1]+v[1]+ans+v[1]+v[2];
if(ans.size()<=n-2)
{
int kol=press(nstr);
if(kol==k+1)
{
ans+=v[0];
}
else if(kol==k+2)
{
ans+=v[1];
}
else
{
ans+=v[2];
}
}
else
{
if(press(ans)==n)
{
break;
}
else if(press(ans+v[0])==n)
{
ans+=v[0];
break;
}
else if(press(ans+v[1])==n)
{
ans+=v[1];
break;
}
else if(press(ans+v[2])==n)
{
ans+=v[2];
break;
}
}
k=ans.size();
}
return ans;
}
Compilation message (stderr)
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |