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 ;
}
Compilation message (stderr)
combo.cpp: In function 'std::string guess_sequence(int)':
combo.cpp:8:10: warning: variable 'x' set but not used [-Wunused-but-set-variable]
8 | char x ;
| ^
combo.cpp:10:18: warning: variable 'ok' set but not used [-Wunused-but-set-variable]
10 | int cnt = 1, ok = 1, cc;
| ^~
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |