답안 #308914

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
308914 2020-10-02T08:54:38 Z bigDuck Password (RMI18_password) C++14
컴파일 오류
0 ms 0 KB
#include<bits/stdc++.h>
using namespace std;
#define INIT  ios_base :: sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
#define mp make_pair
#define pb push_back
#define ft first
#define sc second
#define ll long long
#define pii pair<int, int>
#define count_bits __builtin_popcount
#define int ll



string guess(int n, int s){

string res="";
for(char c='a'; c<=('a'+s-1); c++){
    for(int i=0; (i<=res.length()) && (res.length()<n); i++){
        string s1="", s2="";
        for(int j=0; j<i; j++){
            s1+="a"; s1[s1.length()-1]=res[j];
        }
        for(int j=i; j<res.length(); j++){
            s2+="a"; s2[s2.length()-1]=res[j];
        }
        string st="";
        while(true){
            if( (((int)s1.length())+((int)st.length())+((int)s2.length()))==n  ){
                res=s1+st+s2;
                i=(((int)s1.length())+((int)st.length())); break;
            }
            st+="a"; st[st.length()-1]=c;


            int ln=query(s1+st+s2);
            if(ln==(((int)s1.length())+((int)st.length())+((int)s2.length()))){
                continue;
            }
            else{
                st.erase(st.end()-1, st.end());
                res=s1+st+s2;
                i=(((int)s1.length())+((int)st.length())); break;
            }
        }
    }
}
return res;
}




Compilation message

password.cpp: In function 'std::string guess(long long int, long long int)':
password.cpp:19:20: warning: comparison of integer expressions of different signedness: 'long long int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   19 |     for(int i=0; (i<=res.length()) && (res.length()<n); i++){
      |                   ~^~~~~~~~~~~~~~
password.cpp:19:52: warning: comparison of integer expressions of different signedness: 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} and 'long long int' [-Wsign-compare]
   19 |     for(int i=0; (i<=res.length()) && (res.length()<n); i++){
      |                                        ~~~~~~~~~~~~^~
password.cpp:24:23: warning: comparison of integer expressions of different signedness: 'long long int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   24 |         for(int j=i; j<res.length(); j++){
      |                      ~^~~~~~~~~~~~~
password.cpp:36:20: error: 'query' was not declared in this scope
   36 |             int ln=query(s1+st+s2);
      |                    ^~~~~