#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(a, b) for(int a = 0; a < (b); ++a)
#define st first
#define nd second
#define pb push_back
#define all(a) a.begin(), a.end()
int query(string p);
string guess(int n, int s) {
vector<pair<int,string>>A;
rep(i, s) {
string p="";
rep(j, n) p+=char(i+'a');
int x=query(p);
while(p.size()>x) p.pop_back();
if(x) A.pb({x, p});
}
while(A.size()>1) {
sort(all(A));
reverse(all(A));
string a=A[A.size()-1].nd, b=A[A.size()-2].nd;
A.pop_back(); A.pop_back();
int l=0;
string ans="";
for(auto i : a) {
string x=ans;
x+=i;
for(int j=l; j<b.size(); ++j) x+=b[j];
while(query(x)<x.size()) {
ans+=b[l];
++l;
x=ans;
x+=i;
for(int j=l; j<b.size(); ++j) x+=b[j];
}
ans+=i;
}
while(l<b.size()) {
ans+=b[l];
++l;
}
A.pb({ans.size(), ans});
}
return A[0].nd;
}
# | 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... |