#include<bits/stdc++.h>
using namespace std;
int query(string s);
string guess(int n,int s){
function<string(int,int)> dnc = [&](int l,int r){
if(l==r) return string(query(string(n,'a'+l)),'a'+l);
int mid=(l+r)>>1,i,j;
string lt=dnc(l,mid),rt=dnc(mid+1,r),res;
for(i=0,j=0;i<(int)lt.size() && j<(int)rt.size();){
string cur=res+lt[i]+rt.substr(j);
if(query(cur)==(int)cur.size()) res+=lt[i++];
else res+=rt[j++];
}
if(i==(int)lt.size()) res+=rt.substr(j);
else res+=lt.substr(i);
return res;
};
return dnc(0,s-1);
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
344 KB |
Guessed the password with 61 queries. |
2 |
Correct |
1 ms |
344 KB |
Guessed the password with 101 queries. |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
0 ms |
344 KB |
Guessed the password with 49 queries. |
2 |
Correct |
1 ms |
344 KB |
Guessed the password with 117 queries. |
3 |
Correct |
1 ms |
344 KB |
Guessed the password with 92 queries. |
4 |
Correct |
1 ms |
588 KB |
Guessed the password with 197 queries. |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
24 ms |
1196 KB |
Guessed the password with 3456 queries. |
2 |
Correct |
25 ms |
708 KB |
Guessed the password with 5025 queries. |
3 |
Correct |
43 ms |
712 KB |
Guessed the password with 6352 queries. |
4 |
Correct |
58 ms |
956 KB |
Guessed the password with 8693 queries. |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
344 KB |
Guessed the password with 61 queries. |
2 |
Correct |
1 ms |
344 KB |
Guessed the password with 101 queries. |
3 |
Correct |
0 ms |
344 KB |
Guessed the password with 49 queries. |
4 |
Correct |
1 ms |
344 KB |
Guessed the password with 117 queries. |
5 |
Correct |
1 ms |
344 KB |
Guessed the password with 92 queries. |
6 |
Correct |
1 ms |
588 KB |
Guessed the password with 197 queries. |
7 |
Correct |
24 ms |
1196 KB |
Guessed the password with 3456 queries. |
8 |
Correct |
25 ms |
708 KB |
Guessed the password with 5025 queries. |
9 |
Correct |
43 ms |
712 KB |
Guessed the password with 6352 queries. |
10 |
Correct |
58 ms |
956 KB |
Guessed the password with 8693 queries. |
11 |
Correct |
75 ms |
944 KB |
Guessed the password with 13638 queries. |
12 |
Correct |
75 ms |
700 KB |
Guessed the password with 12459 queries. |
13 |
Correct |
78 ms |
956 KB |
Guessed the password with 14392 queries. |
14 |
Correct |
98 ms |
964 KB |
Guessed the password with 13937 queries. |
15 |
Correct |
98 ms |
964 KB |
Guessed the password with 15073 queries. |
16 |
Correct |
97 ms |
928 KB |
Guessed the password with 14154 queries. |
17 |
Correct |
108 ms |
744 KB |
Guessed the password with 16054 queries. |
18 |
Correct |
109 ms |
988 KB |
Guessed the password with 15189 queries. |
19 |
Correct |
108 ms |
968 KB |
Guessed the password with 16410 queries. |
20 |
Correct |
101 ms |
1212 KB |
Guessed the password with 14247 queries. |
21 |
Correct |
113 ms |
988 KB |
Guessed the password with 16849 queries. |
22 |
Correct |
104 ms |
1468 KB |
Guessed the password with 15315 queries. |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
344 KB |
Guessed the password with 61 queries. |
2 |
Correct |
1 ms |
344 KB |
Guessed the password with 101 queries. |
3 |
Correct |
0 ms |
344 KB |
Guessed the password with 49 queries. |
4 |
Correct |
1 ms |
344 KB |
Guessed the password with 117 queries. |
5 |
Correct |
1 ms |
344 KB |
Guessed the password with 92 queries. |
6 |
Correct |
1 ms |
588 KB |
Guessed the password with 197 queries. |
7 |
Correct |
24 ms |
1196 KB |
Guessed the password with 3456 queries. |
8 |
Correct |
25 ms |
708 KB |
Guessed the password with 5025 queries. |
9 |
Correct |
43 ms |
712 KB |
Guessed the password with 6352 queries. |
10 |
Correct |
58 ms |
956 KB |
Guessed the password with 8693 queries. |
11 |
Correct |
75 ms |
944 KB |
Guessed the password with 13638 queries. |
12 |
Correct |
75 ms |
700 KB |
Guessed the password with 12459 queries. |
13 |
Correct |
78 ms |
956 KB |
Guessed the password with 14392 queries. |
14 |
Correct |
98 ms |
964 KB |
Guessed the password with 13937 queries. |
15 |
Correct |
98 ms |
964 KB |
Guessed the password with 15073 queries. |
16 |
Correct |
97 ms |
928 KB |
Guessed the password with 14154 queries. |
17 |
Correct |
108 ms |
744 KB |
Guessed the password with 16054 queries. |
18 |
Correct |
109 ms |
988 KB |
Guessed the password with 15189 queries. |
19 |
Correct |
108 ms |
968 KB |
Guessed the password with 16410 queries. |
20 |
Correct |
101 ms |
1212 KB |
Guessed the password with 14247 queries. |
21 |
Correct |
113 ms |
988 KB |
Guessed the password with 16849 queries. |
22 |
Correct |
104 ms |
1468 KB |
Guessed the password with 15315 queries. |
23 |
Correct |
162 ms |
1404 KB |
Guessed the password with 23612 queries. |
24 |
Correct |
142 ms |
1440 KB |
Guessed the password with 22226 queries. |
25 |
Correct |
152 ms |
1416 KB |
Guessed the password with 23794 queries. |
26 |
Correct |
153 ms |
1476 KB |
Guessed the password with 23332 queries. |
27 |
Correct |
159 ms |
1620 KB |
Guessed the password with 23763 queries. |
28 |
Correct |
157 ms |
1564 KB |
Guessed the password with 23045 queries. |
29 |
Correct |
149 ms |
1812 KB |
Guessed the password with 23847 queries. |
30 |
Correct |
139 ms |
1000 KB |
Guessed the password with 22506 queries. |