# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
103628 | medk | Combo (IOI18_combo) | C++14 | 3 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
/*
int press(string x)
{
cout<<x<<'\n';
int ret; cin>>ret;
return ret;
}
*/
string guess_sequence(int N)
{
string ans="";
char ci[4]={'A','B','X','Y'};
vector<char> c;
int found=1;
if(press("AB"))
{
if(press("A")) ans="A";
else ans="B";
}
else
{
if(press("X")) ans="X";
else ans="Y";
}
int ind=0;
for(int i=0;i<4;i++)
{
if(ci[i]!=ans[0]){
c.push_back(ci[i]);
}
}
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==(int) ans.length()+2)
{
ans+=c[1];
}
else if(get==(int) ans.length()+1)
{
ans+=c[0];
}
else
{
ans+=c[2];
}
}
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;
}
/*
int main()
{
//string ans=guess_sequence(8);
cout<<ans<<'\n';
return 0;
}
*/
Compilation message (stderr)
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |