# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
955586 | ASGA_RedSea | Combo (IOI18_combo) | C++17 | 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>
using namespace std;
//int press(string s){cout<<"press : "<<s<<" : ";int r;cin>>r;return r;}
string guess_sequence(int n){
string s;
string arr = "ABXY";
for(auto& i : arr){
string ss;ss += i;
if(press(ss) == 1){
s += i;
break;
}
}
arr.erase(find(arr.begin(),arr.end(),s[0]) - arr.begin(),1);
while(s.size() < n){
string p = s;
for(auto& i : arr){
p += i;
int r = press(p);
if(r == s.size() + 1)break;
p.pop_back();
}
s = p;
}
return s;
}
//int main(){int n;cin>>n;cout<<guess_sequence(n);return 0;}