# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
1032466 | ThommyDB | Combo (IOI18_combo) | C++17 | 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 "combo.h"
#include<bits/stdc++.h>
using namespace std;
string guess_sequence(int N) {
string p = "";
if(press("AB")>=1){
if(press("A") >= 1) p+="A";
else p+="B";
}
else{
if(press("X") >= 1) p+="X";
else p+="Y";
}
if(N==1)return p;
vector<char> a;
for(auto u : "ABXY"){
if(u!=p[0]) a.push_back(u);
}
for(int i = 1; i<N-1; i++){
string s = "";
s+=p;s+=p;s+=p;s+=p;s.push_back(a[0]);s.push_back(a[0]);s.push_back(a[1]);s.push_back(a[1]);s.push_back(a[1]);s.push_back(a[1]);s.push_back(a[2]);
int v = press(s);
if(v == p.length() +1) p+=a[0];
else if(v==p.length()+2) p+=a[1];
else p+=a[2];
}
if(press(p+a[0]) == N) p+=a[0]
else if(press(p+a[1])==N) p+=a[1];
else p+=a[2];
return p;
}