#include <iostream>
using namespace std;
string ans;
int query( string p );
char guess_kth( int k, int left, int right ) {
int mid, i;
string q;
if ( left == right )
return left;
mid = (left + right) / 2;
q = ans;
for ( i = left; i <= mid; i++ )
q += i + 'a';
if ( query( q ) > k )
return guess_kth( k, left, mid );
return guess_kth( k, mid + 1, right );
}
string guess( int n, int s ) {
int i;
ans = "";
for ( i = 0; i < n; i++ )
ans += guess_kth( i, 0, s - 1 ) + 'a';
return ans;
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Runtime error |
1 ms |
200 KB |
Execution killed with signal 13 |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
1 ms |
288 KB |
Returned early from guess() after 51 queries. |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Runtime error |
13 ms |
324 KB |
Execution killed with signal 13 |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Runtime error |
1 ms |
200 KB |
Execution killed with signal 13 |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Runtime error |
1 ms |
200 KB |
Execution killed with signal 13 |
2 |
Halted |
0 ms |
0 KB |
- |