답안 #1087868

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
1087868 2024-09-13T10:40:21 Z ASN49K Password (RMI18_password) C++14
컴파일 오류
0 ms 0 KB
#include <bits/stdc++.h>
//#include "grader.h"
using namespace std;

string divide(int n,int l,int r)
{
    if(l==r)
    {
        //return string(guess(string(n,char('a'+l))) , char('a'+l));
        return string(query(string(n,char('a'+l))) , char('a'+l));
    }
    int m=(l+r)/2;
    string a=divide(n,l,m);
    string b=divide(n,m+1,r);

    string rez;
    while(a.size() && b.size())
    {
        if(query(rez+a[0]+b)==rez.size()+1+b.size())
        {
            rez.push_back(a[0]);
            a.erase(a.begin());
        }
        else
        {
            rez.push_back(b[0]);
            b.erase(b.begin());
        }
    }
    rez+=a;
    rez+=b;
    return rez;
}
string guess(int n, int s)
{
    return divide(n,0,s-1);
}

Compilation message

password.cpp: In function 'std::string divide(int, int, int)':
password.cpp:10:23: error: 'query' was not declared in this scope
   10 |         return string(query(string(n,char('a'+l))) , char('a'+l));
      |                       ^~~~~
password.cpp:19:12: error: 'query' was not declared in this scope
   19 |         if(query(rez+a[0]+b)==rez.size()+1+b.size())
      |            ^~~~~