#include <bits/stdc++.h>
using namespace std;
int query(string str);
string guess(int n, int s) {
string S(n, 'a');
int freq[s], used[s];
for(int l = 0; l < s; l++) {
used[l] = 0;
for(int i = 0; i < n; i++)
S[i] = char(l + 'a');
freq[l] = query(S);
}
S = "";
for(int l = 0; l < n; l++) {
S.push_back('a');
for(int i = 0; i < s; i++) {
if(used[i] == freq[i]) continue;
S[l] = char(i + 'a');
if(l < n - 1) {
used[i]++; int cnt = 0, tr = 0;
for(int j = 0; j < s; j++) {
if(used[j] == freq[j]) continue;
tr++;
for(int e = used[j] + 1; e <= freq[j]; e++)
S.push_back(char(j + 'a'));
int R = query(S); R -= l;
if(R == 1 + freq[j] - used[j])
cnt++;
else break;
for(int e = used[j] + 1; e <= freq[j]; e++)
S.pop_back();
}
used[i]--;
if(cnt == tr){
used[i]++;
break;
}
}
else {
int K = query(S);
if(K == n) break;
}
}
}
return S;
}
# |
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 |
0 ms |
208 KB |
Execution killed with signal 13 |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Runtime error |
5 ms |
328 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 |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Runtime error |
1 ms |
208 KB |
Execution killed with signal 13 |
2 |
Halted |
0 ms |
0 KB |
- |