# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
133401 | reda | Combo (IOI18_combo) | C++14 | 0 ms | 0 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 ;
string guess_sequence(int N)
{
if(N==3)
{
string ans="";
string use="ABXY";
int g=-1;
char t;
for(int i=0;i<use.size();i++)
{
if(press(use[i])>g)
{
g=press(use[i]);
t=use[i];
}
}
ans+=t;
string s="";
for(int i=0;i<use.size();i++)
{
if(use[i]==t)continue;
s+=use[i];
}
int i=0,pv=press(ans);
while (ans.size()!=3)
{
string p=ans;
p+=s[i];
int k =press(p);
if(k>prev)
{
ans+=s[i];
}
else i++;
i=i%3;
}
return ans;
}
}