# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
335307 | fadi57 | Combo (IOI18_combo) | C++14 | 112 ms | 584 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>
//#include"grader.cpp"
using namespace std;
std::string guess_sequence(int N) {
std::string p = "";
string s="ABXY";
string first;
int query=press("AB");
string ret;
if(query){
ret=press("A")?"A":"B";
}else{
ret=press("X")?"X":"Y";
}
first=ret;
s.erase(find(s.begin(),s.end(),first[0]));
//cout<<s<<endl;
int si=N;si--;
int now=2;
for(int i=2;i<N;i++){
string tr=ret+s[0]+ret+s[1]+s[0]+ret+s[1]+s[1]+ret+s[1]+s[2];
//cout<<"DEBUG "<<tr<<endl;
query=press(tr);
if(query==now){ret+=s[0];}else if(query==(now+1)){ret+=s[1];}else{ret+=s[2];}
now++;
}if(ret.size()==N){return ret;}
if(press(ret+s[0])==N){
ret+=s[0];
}else if(press(ret+s[1])==N){ret+=s[1];}else{
ret+=s[2];
}//cout<<ret<<endl;
return ret;
}
Compilation message (stderr)
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |