Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #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="";
- int num=press("AB");
- if(num==2)
- {
- ans+="A";
- v.erase(v.begin()+0);
- }
- else if(num==1)
- {
- int num2=press("A");
- if(num2==1)
- {
- ans+="A";
- v.erase(v.begin()+0);
- }
- else
- {
- ans+="B";
- v.erase(v.begin()+1);
- }
- }
- else if(num==0)
- {
- int m=press("X");
- if(m==1)
- {
- ans+="X";
- v.erase(v.begin()+2);
- }
- else
- {
- ans+="Y";
- v.erase(v.begin()+3);
- }
- }
- while(true)
- {
- int k=ans.size();
- string nstr="";
- nstr+=ans+v[0]+ans+v[1]+v[0]+ans+v[1]+v[1]+ans+v[1]+v[2];
- if(nstr.size()<=4*n)
- {
- 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(n==1)
- {
- break;
- }
- if(press(ans+v[0])==n)
- {
- ans+=v[0];
- break;
- }
- if(press(ans+v[1])==n)
- {
- ans+=v[1];
- break;
- }
- ans+=v[2];
- break;
- }
- }
- return ans;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement