# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
937010 | Yazan_SA | 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;
//int press(string p)
//{
//
//}
string guess_sequence(int N)
{
string ans="";
string bts="ABXY";
int mx=0,mxp=0;
while(mx!=N)
{
if(ans!="" && (int)bts.size()==4) {
bts.erase(bts.begin()+bts.find(ans[0]));
}
mx=press(ans+bts[0]+ans+bts[1]);
if(mx>mxp)
{
if(mxp != press(ans+bts[0]))ans+=bts[0];
else ans+=bts[1];
}
}
else if(ans=="")
{
if(mxp+1==press(ans+bts[2]))ans+=bts[2];
else ans+=bts[3];
}
else ans+=bts[2];
mxp=ans.size();
}
return ans;
}
//int main()
//{
// string s="abcd";
// s.erase(s.begin()+s.find('a'));
// cout<<s;
//}