#include<bits/stdc++.h>
using namespace std;
#define rep(a, b) for(int a = 0; a < (b); ++a)
int query(string p);
string guess(int n, int s) {
string ans="";
rep(i, n-s) {
int p=0, k=s-1;
while(p<k) {
int sr=(p+k)/2;
string p=ans;
rep(i, sr+1) p+=char(i+'a');
int a=query(p);
if(a==n) return p;
if(a>i) k=sr; else p=sr+1;
}
ans+=char(p+'a');
}
for(int i=max(n-s, 0); i<n; ++i) {
int x=-1;
rep(j, s) if(x==-1) {
string p=ans+char(j+'a');
int a=query(p);
if(a==n) return p;
if(a>i) x=j;
}
ans+=char(x+'a');
}
return ans;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Runtime error |
1 ms |
208 KB |
Execution killed with signal 13 |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
390 ms |
208 KB |
Could not guess the password with 50000 queries. |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
227 ms |
208 KB |
Could not guess the password with 50000 queries. |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Runtime error |
1 ms |
208 KB |
Execution killed with signal 13 |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Runtime error |
1 ms |
208 KB |
Execution killed with signal 13 |
2 |
Halted |
0 ms |
0 KB |
- |