답안 #985242

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
985242 2024-05-17T13:43:51 Z bachhoangxuan Password (RMI18_password) C++17
컴파일 오류
0 ms 0 KB
#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++];
      |                ^~~~~