#include <bits/stdc++.h>
using namespace std;
int f[26];
int query(string s);
string guess(int n,int c)
{
for (char a='a';a<'a'+c;a++)
f[a-'a']=query(string(n,a));
string ans="";
for (char a='a';a<'a'+c;a++)
{
string tmp=ans;
for (int i=0;i<f[a-'a'];i++)
{
int st=0,en=ans.size();
while (st!=en)
{
int mid=(st+en+1)/2;
if (query(ans.substr(0,mid)+string(i+1,a))>mid+i)
st=mid;
else
en=mid-1;
}
tmp.insert(tmp.begin()+st,a);
}
ans=tmp;
}
return ans;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
6 ms |
376 KB |
Guessed the password with 58 queries. |
2 |
Correct |
6 ms |
248 KB |
Guessed the password with 100 queries. |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
7 ms |
248 KB |
Guessed the password with 123 queries. |
2 |
Correct |
6 ms |
280 KB |
Guessed the password with 134 queries. |
3 |
Correct |
8 ms |
376 KB |
Guessed the password with 246 queries. |
4 |
Correct |
11 ms |
248 KB |
Guessed the password with 450 queries. |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
86 ms |
320 KB |
Guessed the password with 7921 queries. |
2 |
Correct |
115 ms |
376 KB |
Guessed the password with 11048 queries. |
3 |
Correct |
180 ms |
324 KB |
Guessed the password with 13621 queries. |
4 |
Correct |
224 ms |
248 KB |
Guessed the password with 18468 queries. |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
6 ms |
376 KB |
Guessed the password with 58 queries. |
2 |
Correct |
6 ms |
248 KB |
Guessed the password with 100 queries. |
3 |
Correct |
7 ms |
248 KB |
Guessed the password with 123 queries. |
4 |
Correct |
6 ms |
280 KB |
Guessed the password with 134 queries. |
5 |
Correct |
8 ms |
376 KB |
Guessed the password with 246 queries. |
6 |
Correct |
11 ms |
248 KB |
Guessed the password with 450 queries. |
7 |
Correct |
86 ms |
320 KB |
Guessed the password with 7921 queries. |
8 |
Correct |
115 ms |
376 KB |
Guessed the password with 11048 queries. |
9 |
Correct |
180 ms |
324 KB |
Guessed the password with 13621 queries. |
10 |
Correct |
224 ms |
248 KB |
Guessed the password with 18468 queries. |
11 |
Correct |
281 ms |
456 KB |
Guessed the password with 22701 queries. |
12 |
Correct |
353 ms |
504 KB |
Guessed the password with 27196 queries. |
13 |
Correct |
369 ms |
452 KB |
Guessed the password with 27528 queries. |
14 |
Correct |
344 ms |
336 KB |
Guessed the password with 29636 queries. |
15 |
Correct |
392 ms |
332 KB |
Guessed the password with 28439 queries. |
16 |
Correct |
451 ms |
632 KB |
Guessed the password with 31688 queries. |
17 |
Correct |
402 ms |
460 KB |
Guessed the password with 28308 queries. |
18 |
Correct |
410 ms |
376 KB |
Guessed the password with 32899 queries. |
19 |
Correct |
351 ms |
248 KB |
Guessed the password with 27716 queries. |
20 |
Correct |
466 ms |
584 KB |
Guessed the password with 33881 queries. |
21 |
Correct |
422 ms |
336 KB |
Guessed the password with 31243 queries. |
22 |
Correct |
495 ms |
404 KB |
Guessed the password with 35620 queries. |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
6 ms |
376 KB |
Guessed the password with 58 queries. |
2 |
Correct |
6 ms |
248 KB |
Guessed the password with 100 queries. |
3 |
Correct |
7 ms |
248 KB |
Guessed the password with 123 queries. |
4 |
Correct |
6 ms |
280 KB |
Guessed the password with 134 queries. |
5 |
Correct |
8 ms |
376 KB |
Guessed the password with 246 queries. |
6 |
Correct |
11 ms |
248 KB |
Guessed the password with 450 queries. |
7 |
Correct |
86 ms |
320 KB |
Guessed the password with 7921 queries. |
8 |
Correct |
115 ms |
376 KB |
Guessed the password with 11048 queries. |
9 |
Correct |
180 ms |
324 KB |
Guessed the password with 13621 queries. |
10 |
Correct |
224 ms |
248 KB |
Guessed the password with 18468 queries. |
11 |
Correct |
281 ms |
456 KB |
Guessed the password with 22701 queries. |
12 |
Correct |
353 ms |
504 KB |
Guessed the password with 27196 queries. |
13 |
Correct |
369 ms |
452 KB |
Guessed the password with 27528 queries. |
14 |
Correct |
344 ms |
336 KB |
Guessed the password with 29636 queries. |
15 |
Correct |
392 ms |
332 KB |
Guessed the password with 28439 queries. |
16 |
Correct |
451 ms |
632 KB |
Guessed the password with 31688 queries. |
17 |
Correct |
402 ms |
460 KB |
Guessed the password with 28308 queries. |
18 |
Correct |
410 ms |
376 KB |
Guessed the password with 32899 queries. |
19 |
Correct |
351 ms |
248 KB |
Guessed the password with 27716 queries. |
20 |
Correct |
466 ms |
584 KB |
Guessed the password with 33881 queries. |
21 |
Correct |
422 ms |
336 KB |
Guessed the password with 31243 queries. |
22 |
Correct |
495 ms |
404 KB |
Guessed the password with 35620 queries. |
23 |
Incorrect |
612 ms |
576 KB |
Could not guess the password with 50000 queries. |
24 |
Halted |
0 ms |
0 KB |
- |