# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
778026 | Warinchai | Combo (IOI18_combo) | C++14 | 26 ms | 692 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 guess_sequence(int n){
string s="";
int x=press("AB");
char st;
if(x>=1){
int y=press("A");
if(y>=1){
s+='A';
}else{
s+='B';
}
}else{
int y=press("X");
if(y>=1){
s+='X';
}else{
s+='Y';
}
}
st=s[0];
//cout<<"st:"<<st<<endl;
vector<char>v;
if(s[0]!='A'){
v.push_back('A');
}
if(s[0]!='B'){
v.push_back('B');
}
if(s[0]!='X'){
v.push_back('X');
}
if(s[0]!='Y'){
v.push_back('Y');
}
for(int i=2;i<=n-1;i++){
string tmp="";
tmp+=s+v[0];
for(int j=0;j<3;j++){
tmp+=s+v[1]+v[j];
}
int c=press(tmp);
//cout<<i<<":"<<tmp<<" "<<c<<endl;
if(c==i-1){
s+=v[2];
}else if(c==i){
s+=v[0];
}else{
s+=v[1];
}
}
//cout<<"before last "<<s<<endl;
if(n==1){
return s;
}
string tmp="";
tmp=s+v[0];
int c=press(tmp);
if(c==n){
s=tmp;
}else{
tmp=s+v[1];
c=press(tmp);
if(c==n){
s=tmp;
}else{
s=s+v[2];
}
}
//cout<<s<<endl;
return s;
}
Compilation message (stderr)
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |