답안 #1117317

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
1117317 2024-11-23T10:00:09 Z Ciprian Password (RMI18_password) C++14
컴파일 오류
0 ms 0 KB
#include <bits/stdc++.h>
using namespace std;
#define int long long 

string guess(int n, int s){
    char a='a';
    vector<char>c;
    char b[30];
    for(int j=1; j<=s; j++){
        if(query(string(1,a))==1)c.push_back(a);
        a++;
    }
    for(int j=0; j<c.size(); j++){
        int cnt=0;
        for(int i=0; i<c.size(); i++){
            if(j!=i){
                if(query(string(1,c[i])+c[j])==2)cnt++;
            }
        }b[cnt]=c[j];   
    }string w;
    for(int j=0; j<n; j++)w+=b[j];
    return w;
}

Compilation message

password.cpp: In function 'std::string guess(long long int, long long int)':
password.cpp:11:12: error: 'query' was not declared in this scope
   11 |         if(query(string(1,a))==1)c.push_back(a);
      |            ^~~~~
password.cpp:14:19: warning: comparison of integer expressions of different signedness: 'long long int' and 'std::vector<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   14 |     for(int j=0; j<c.size(); j++){
      |                  ~^~~~~~~~~
password.cpp:16:23: warning: comparison of integer expressions of different signedness: 'long long int' and 'std::vector<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   16 |         for(int i=0; i<c.size(); i++){
      |                      ~^~~~~~~~~
password.cpp:18:20: error: 'query' was not declared in this scope
   18 |                 if(query(string(1,c[i])+c[j])==2)cnt++;
      |                    ^~~~~