# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
234140 | Binyomin | Combo (IOI18_combo) | C++14 | 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 <bits/stdc++.h>
//#include "combo.h"
using namespace std ;
string guess_sequence(int N) {
vector < char > s, a = { 'A', 'B', 'X', 'Y' } ;
char x ;
string ans = "", p = "";
int cnt = 1, ok = 1, cc;
if( press("AB") ) {
if( press("A") ) {
ok =1 ;
ans ="A";
x = 'A';
s = { 'B', 'X', 'Y' } ;
}
else {
ok =1 ;
ans ="B";
x = 'B';
s = {'A', 'X', 'Y' };
}
}
else {
if( press("X") ) {
ok =1 ;
ans ="X";
x = 'X';
s = {'A', 'B', 'Y' };
}
else{
ok =1 ;
ans ="Y";
x = 'Y';
s = {'A', 'B', 'X'};
}
}
while( cnt != N ) {
p = ans + s[0] + ans + s[1] + ans + s[1] ;
cc = press(p) ;
if( cc == cnt + 2 ) {
cnt ++ ;
ans += s[1] ;
}
else if( cc == cnt + 1 ) {
cnt ++ ;
ans += s[0] ;
}
else {
cnt ++ ;
ans += s[2] ;
}
}
return ans ;
}