#include<bits/stdc++.h>
using namespace std;
int query(string str);
string merge(vector<string>& sol, int lo, int hi){
if(lo == hi) return sol[lo];
int mi = (lo + hi) / 2;
string s1 = merge(sol, lo, mi), s2 = merge(sol, mi + 1, hi), res = "";
int curr = 0, dex = 0;
while(curr < (int)s1.size() && dex < (int)s2.size()){
if(query(res + s2[dex] + s1.substr(curr)) == (int)res.size() + (int)s1.size() - curr + 1) res += s2[dex++];
else res += s1[curr++];
}
return res + s1.substr(curr) + s2.substr(dex);
}
string guess(int n, int s){
vector<string> sol(26, "");
for(int i = 0; i < s; i++){
string ss(n, 'a' + i);
sol[i].assign(query(ss), 'a' + i);
}
return merge(sol, 0, s - 1);
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
364 KB |
Guessed the password with 60 queries. |
2 |
Runtime error |
1 ms |
364 KB |
Execution killed with signal 13 (could be triggered by violating memory limits) |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
364 KB |
Guessed the password with 48 queries. |
2 |
Correct |
1 ms |
364 KB |
Guessed the password with 116 queries. |
3 |
Correct |
2 ms |
364 KB |
Guessed the password with 91 queries. |
4 |
Correct |
5 ms |
364 KB |
Guessed the password with 198 queries. |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
38 ms |
420 KB |
Guessed the password with 3455 queries. |
2 |
Correct |
49 ms |
364 KB |
Guessed the password with 5024 queries. |
3 |
Correct |
78 ms |
492 KB |
Guessed the password with 6353 queries. |
4 |
Correct |
102 ms |
620 KB |
Guessed the password with 8694 queries. |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
364 KB |
Guessed the password with 60 queries. |
2 |
Runtime error |
1 ms |
364 KB |
Execution killed with signal 13 (could be triggered by violating memory limits) |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
364 KB |
Guessed the password with 60 queries. |
2 |
Runtime error |
1 ms |
364 KB |
Execution killed with signal 13 (could be triggered by violating memory limits) |