#include<bits/stdc++.h>
#include "combo.h"
std::string guess_sequence( int N ) {
std::string p = "";
std::string S = "";
char c[] = {'A', 'B', 'X', 'Y'};
p.push_back( 'A' );
p.push_back( 'B' );
if( press(p) != 0 ){
p.clear(); p.push_back( 'A' );
if( press(p) == 1 )
S.push_back( 'A' );
else
S.push_back( 'B' ), std::swap( c[0], c[1] );
}else{
p.clear(); p.push_back( 'X' );
if( press(p) == 1 )
S.push_back( 'X' ), std::swap( c[0], c[2] );
else
S.push_back( 'Y' ), std::swap( c[0], c[3] );
}
for( int i = 2; i < N; i++ ){
p.clear();
p.append( S ); p.push_back( c[1] );
p.append( S ); p.push_back( c[2] ); p.push_back( c[1] );
p.append( S ); p.push_back( c[2] ); p.push_back( c[2] );
p.append( S ); p.push_back( c[2] ); p.push_back( c[3] );
///std::cout << p << "\n";
int ans = press( p );
if( ans == i )
S.push_back( c[1] );
else
if( ans == i + 1 )
S.push_back( c[2] );
else
S.push_back( c[3] );
}
p.clear();
p = S;
p.push_back( c[1] );
if( press(p) == N ){
S = p;
}else{
p.back() = c[2];
if( press(p) == N )
S = p;
else
S.push_back( c[3] );
}
return S;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
2 ms |
216 KB |
Output is correct |
2 |
Correct |
2 ms |
216 KB |
Output is correct |
3 |
Correct |
2 ms |
256 KB |
Output is correct |
4 |
Correct |
1 ms |
276 KB |
Output is correct |
5 |
Correct |
2 ms |
296 KB |
Output is correct |
6 |
Correct |
2 ms |
216 KB |
Output is correct |
7 |
Correct |
2 ms |
256 KB |
Output is correct |
8 |
Correct |
1 ms |
216 KB |
Output is correct |
9 |
Correct |
1 ms |
216 KB |
Output is correct |
10 |
Correct |
2 ms |
216 KB |
Output is correct |
11 |
Correct |
2 ms |
216 KB |
Output is correct |
12 |
Correct |
2 ms |
216 KB |
Output is correct |
13 |
Correct |
1 ms |
216 KB |
Output is correct |
14 |
Correct |
1 ms |
216 KB |
Output is correct |
15 |
Correct |
2 ms |
216 KB |
Output is correct |
16 |
Correct |
1 ms |
216 KB |
Output is correct |
17 |
Correct |
2 ms |
244 KB |
Output is correct |
18 |
Correct |
1 ms |
216 KB |
Output is correct |
19 |
Correct |
2 ms |
256 KB |
Output is correct |
20 |
Correct |
1 ms |
216 KB |
Output is correct |
21 |
Correct |
3 ms |
216 KB |
Output is correct |
22 |
Correct |
2 ms |
216 KB |
Output is correct |
23 |
Correct |
1 ms |
216 KB |
Output is correct |
24 |
Correct |
1 ms |
260 KB |
Output is correct |
25 |
Correct |
1 ms |
280 KB |
Output is correct |
26 |
Correct |
1 ms |
280 KB |
Output is correct |
27 |
Correct |
2 ms |
216 KB |
Output is correct |
28 |
Correct |
2 ms |
216 KB |
Output is correct |
29 |
Correct |
2 ms |
216 KB |
Output is correct |
30 |
Correct |
1 ms |
216 KB |
Output is correct |
31 |
Correct |
1 ms |
216 KB |
Output is correct |
32 |
Correct |
2 ms |
256 KB |
Output is correct |
33 |
Correct |
2 ms |
216 KB |
Output is correct |
34 |
Correct |
2 ms |
236 KB |
Output is correct |
35 |
Correct |
1 ms |
256 KB |
Output is correct |
36 |
Correct |
1 ms |
216 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
2 ms |
216 KB |
Wrong Answer: wrong guess. |
2 |
Halted |
0 ms |
0 KB |
- |