# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
739013 | raul2008487 | Combo (IOI18_combo) | C++17 | 31 ms | 572 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>
#define pb push_back
using namespace std;
#include "combo.h"
std::string guess_sequence(int N) {
std::string s="";
int cc=1,st;
int cs1=press("AB"),cs2=press("AX");
std::vector<char> vec;
if(cs1==2){
s+="AB";
vec.pb('B');
vec.pb('X');
vec.pb('Y');
}
else if(cs2==2){
s+="AX";
vec.pb('B');
vec.pb('X');
vec.pb('Y');
}
else if(cs1==1 && cs2==1){
s+="A";
vec.pb('B');
vec.pb('X');
vec.pb('Y');
}
else if(cs1==1){
s+='B';
vec.pb('A');
vec.pb('X');
vec.pb('Y');
}
else if(cs2==1){
s+='X';
vec.pb('A');
vec.pb('B');
vec.pb('Y');
}
else{
s+='Y';
vec.pb('B');
vec.pb('X');
vec.pb('A');
}
st=s.size();
if(st==N){
return s;
}
for(int i=st;i<N-1;i++){
int query=press(s+vec[0]+s+vec[1]+vec[0]+s+vec[1]+vec[1]+s+vec[1]+vec[2]);
if(query==(i+1)){
s+=vec[0];
}
else if(query==(i+2)){
s+=vec[1];
}
else{
s+=vec[2];
}
}
if(press(s+vec[0])==N){
return s+vec[0];
}
else if(press(s+vec[1])==N){
return s+vec[1];
}
return s+vec[2];
}
Compilation message (stderr)
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |