#include <iostream>
using namespace std;
string ans, q;
int query( string p );
char guess_kth( int k, int left, int right ) {
char ch;
int mid;
if ( left == right )
return left;
mid = (left + right) / 2;
q = "";
for ( ch = left + 'a'; ch <= mid + 'a'; ch++ )
q += ch;
if ( query( ans + q ) > k )
return guess_kth( k, left, mid );
return guess_kth( k, mid + 1, right );
}
string guess( int n, int s ) {
char ch;
int i;
ans = "";
for ( i = 0; i < n - s; i++ )
ans += guess_kth( i, 0, s - 1 ) + 'a';
for ( i = max( n - s, 0 ); i < n; i++ ) {
ch = 'a';
while ( query( ans + ch ) <= i )
ch++;
ans += ch;
}
return ans;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Runtime error |
1 ms |
200 KB |
Execution killed with signal 13 |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Runtime error |
1 ms |
200 KB |
Execution killed with signal 13 |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Runtime error |
33 ms |
400 KB |
Execution killed with signal 13 |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Runtime error |
1 ms |
200 KB |
Execution killed with signal 13 |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Runtime error |
1 ms |
200 KB |
Execution killed with signal 13 |
2 |
Halted |
0 ms |
0 KB |
- |