답안 #199643

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
199643 2020-02-02T12:15:40 Z mohammedehab2002 Password (RMI18_password) C++14
컴파일 오류
0 ms 0 KB
#include <bits/stdc++.h>
using namespace std;
int f[26];
string guess(int n,int c)
{
	for (char a='a';a<'a'+c;a++)
	f[a-'a']=query(string(n,a));
	string ans="";
	for (char a='a';a<'a'+c;a++)
	{
		string tmp=ans;
		for (int i=0;i<f[a-'a'];i++)
		{
			int st=0,en=ans.size();
			while (st!=en)
			{
				int mid=(st+en+1)/2;
				if (query(ans.substr(0,mid)+string(i+1,a))>mid+i)
				st=mid;
				else
				en=mid-1;
			}
			tmp.insert(tmp.begin()+st,a);
		}
		ans=tmp;
	}
	return ans;
}

Compilation message

password.cpp: In function 'std::__cxx11::string guess(int, int)':
password.cpp:7:11: error: 'query' was not declared in this scope
  f[a-'a']=query(string(n,a));
           ^~~~~
password.cpp:18:9: error: 'query' was not declared in this scope
     if (query(ans.substr(0,mid)+string(i+1,a))>mid+i)
         ^~~~~