This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#include <bits/stdc++.h>
//#include"grader.cpp"
using namespace std;
int query(string s);
int f[30];
string guess(int n, int s) {
string ans;
for (int i = 0; i < s; i++) {
char c = 'a' + i;
string q(n, c);
f[i] = query(q);
}
int st = 0;
for (int i = 0; i < s; i++) {
if (f[i] > 0) {
char c = i + 'a';
for (int j = 1; j <= f[i]; i++) {
ans += c;
}
st = i + 1;
break;
}
}
int curlen = ans.length();
for (int i = st; i < s; i++) {
char c = i + 'a';
string ch;
ch += c;
int pos = -1;
string q;
while (true) {
if (f[i] == 0) break;
if (pos == -1) {
q = ch + ans;
} else {
q = ans.substr(0, pos + 1) + ch;
q += ans.substr(pos + 1, curlen - pos - 1);
}
if (query(q) == curlen + 1) {
ans = q;
curlen++;
pos++;
f[i]--;
} else {
pos++;
}
if (pos >= curlen) break;
}
}
return ans;
}
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |