# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
500483 | Khizri | Combo (IOI18_combo) | C++17 | 32 ms | 704 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 "combo.h"
#include <bits/stdc++.h>
using namespace std;
string x="ABXY",y="ABXY";
int k=0;
char ask(string ans,int n){
string p="";
p+=ans;
p+=x[0];
for(int i=0;i<x.size();i++){
p+=ans;
p+=x[1];
p+=x[i];
}
int k=press(p);
if(k==ans.size()+1){
return x[0];
}
else if(k==ans.size()+2){
return x[1];
}
else{
return x[2];
}
}
string guess_sequence(int n) {
string ans="";
int l=0,r=x.size()-1;
while(l<=r){
int m=(l+r)/2;
string a="";
for(int i=l;i<=m;i++){
a+=x[i];
}
if(press(a)){
r=m-1;
}
else{
l=m+1;
}
}
ans+=x[r+1];
x.erase(x.begin()+r+1);
for(int i=1;i<n-1;i++){
ans+=ask(ans,n);
}
if(n==1){
return ans;
}
string a=ans,b=ans;
a+=x[0];
b+=x[1];
if(press(a)==n){
ans+=x[0];
}
else if(press(b)==n){
ans+=x[1];
}
else{
ans+=x[2];
}
return ans;
}
Compilation message (stderr)
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |