# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
706044 | mseebacher | 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 s = "";
vector<char> se = {'A','B','X','Y'};
if(press(se[0]+se[1])){
s = press(se[0]) ? se[0] : se[1];
}else{
s = press(se[2]) ? se[2] : se[3];
}
se.erase(find(se.begin(),se.end(),s[0]));
while(s.length() < n-1){
string zwischen = s+se[0]+se[0]+s+se[0]+se[1]+s+se[0]+se[2]+s+se[1];
int erg = press(zwischen);
if(erg == s.length()+2){
s+=se[0];
}else if(erg == s.length()+1){
s+=se[1];
}else{
s+=se[2];
}
}
if(s.length() == n) return s;
if(press(s+se[0]) == n) return s+se[0];
if(press(s+se[1]) == n) return s+se[1];
return s+se[2];
}