# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
103813 | beso123 | 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 a="ABXY";
string pas;
int qu;
int press(string s){
qu++;
int r=0;
string b="";
for(int k=0;k<pas.size();k++){
b=b+pas[k];
if(s.find(b)==-1)
return r;
r++;
}
return r;
}*/
string guess_sequence(int N){
string s;
int num,i=0;
string b;
s=a[0]+a[1];
if(press(s)==1){
s=a[0];
if(press(s)==1){
b+=s;
a.erase(0,1);
}
else{
b+=a[1];
a.erase(1,1);
}
}
else{
s=a[2];
if(press(s)==1){
b+=s;
a.erase(2,1);
}
else{
b+=a[3];
a.erase(3,1);
}
}
while(b.size()<N-1){
string c=b+a[0]+b+a[1]+a[0]+b+a[1]+a[2]+b+a[1]+a[1];
int ps=press(c);
if(ps==b.size())
b+=a[2];
else{
if(ps==b.size()+1)
b+=a[0];
else
if(ps==b.size()+2)
b+=a[1];
}
}
i=0;
while(true){
s=b+a[i];
num=press(s);
if(num==b.size()+1){
b+=a[i];
break;
}
i++;
}
return b;
}
/*int main(){
cin>>pas;
string s=guess_sequence(pas.size());
cout<<s<<' '<<qu;
return 0;
}*/