# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
937046 | Yazan_SA | Combo (IOI18_combo) | C++14 | 13 ms | 1732 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;
std::string guess_sequence(int N)
{
std::string ans="";
std::string bts="ABXY";
int mx=1;
ans+=(press(ans+bts[0]+bts[1])?press(ans+bts[0])?bts[0]:bts[1]:(press(ans+bts[2])?bts[2]:bts[3]));
bts.erase(bts.begin()+bts.find(ans[0]));
while((int)ans.size()!=N)
{
//cout<<ans+bts[0]+ans+bts[1]+bts[0]+ans+bts[1]+bts[1]+ans+bts[1]+bts[2]<<endl;
if((int)ans.size()+1==N){
if(press(ans+bts[0]+ans+bts[1])>(int)ans.size())
{
if(mx!=press(ans+bts[0]))ans+=bts[0];
else ans+=bts[1];
}
else ans+=bts[2];
}
else{
int tm=press(ans+bts[0]+ans+bts[1]+bts[0]+ans+bts[1]+bts[1]+ans+bts[1]+bts[2]);
if(tm>(int)ans.size())
{
if(tm-2==ans.size())ans+=bts[1];
else ans+=bts[0];
}
else ans+=bts[2];
}
mx=ans.size();
}
return ans;
}
//int main()
//{
// string s="abcd";
// s.erase(s.begin()+s.find('a'));
// cout<<s;
//}
Compilation message (stderr)
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |