#include<bits/stdc++.h>
using namespace std;
string guess(int n,int s){
function<string(int,int)> dnc = [&](int l,int r){
if(l==r) return string(query(string(n,'a'+l)),'a'+l);
int mid=(l+r)>>1,i,j;
string lt=dnc(l,mid),rt=dnc(mid+1,r),res;
for(i=0,j=0;i<(int)lt.size() && j<(int)rt.size();){
string cur=res+lt[i]+rt.substr(j);
if(query(cur)==(int)cur.size()) res+=lt[i++];
else res+=rt[j++];
}
if(i==(int)lt.size()) res+=rt.substr(j);
else res+=lt.substr(i);
return res;
};
return dnc(0,s-1);
}
Compilation message
password.cpp: In lambda function:
password.cpp:6:32: error: 'query' was not declared in this scope
6 | if(l==r) return string(query(string(n,'a'+l)),'a'+l);
| ^~~~~
password.cpp:11:16: error: 'query' was not declared in this scope
11 | if(query(cur)==(int)cur.size()) res+=lt[i++];
| ^~~~~