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>
using namespace std;
#define rep(i, a, b) for(int i = a; i < (b); ++i)
#define all(x) begin(x), end(x)
#define sz(x) (int)(x).size()
typedef long long ll;
typedef pair<int, int> pii;
typedef vector<int> vi;
int query(string q);
string guess(int N, int S) {
string res;
{
string q(N, 'a');
res = string(query(q), 'a');
}
for (int i = 1; i < S; ++i) {
int included = 0;
int at = sz(res);
while (true) {
int lo = -1;
int hi = at + 1;
while (hi - lo > 1) {
int mid = (lo + hi + 1) / 2;
string q = res.substr(0, mid) + string(included + 1, 'a' + i);
if (query(q) == sz(q)) {
lo = mid;
} else {
hi = mid;
}
}
if (lo == -1) break;
res.insert(res.begin() + lo, 'a' + i);
at = hi;
++included;
}
}
return res;
}
# | 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... |