Submission #755940

# Submission time Handle Problem Language Result Execution time Memory
755940 2023-06-10T18:06:11 Z vjudge1 Password (RMI18_password) C++17
Compilation error
0 ms 0 KB
///YOU WILL MAKE IT
#include<bits/stdc++.h>
using namespace std;
int query(string s){
    int p1=0;
    string pass="abab";
    cout<<s<<endl;
    for(int i=0;i<pass.size();i++){
        if(p1<s.size()&&s[p1]==pass[i]){
            p1++;

        }
    }
    return p1;
}
string guess(int n,int s){
    string ans="";
    for(int i=0;i<s;i++){
        for(int j=0;j<n;j++){
            bool f=0;
            for(int k=0;k<ans.size();k++){
                string temp=ans;
                temp.insert(temp.begin()+k,i+'a');
                if(query(temp)==temp.size()){
                    ans=temp;
                    f=1;
                    break;
                }
            }
            if(!f){
                string temp=ans;
                temp.push_back(i+'a');
                if(query(temp)==temp.size()){
                    ans=temp;
                    f=1;
                   // break;
                }
            }

        }
    }
    return ans;
}

Compilation message

password.cpp: In function 'int query(std::string)':
password.cpp:8:18: warning: comparison of integer expressions of different signedness: 'int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
    8 |     for(int i=0;i<pass.size();i++){
      |                 ~^~~~~~~~~~~~
password.cpp:9:14: warning: comparison of integer expressions of different signedness: 'int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
    9 |         if(p1<s.size()&&s[p1]==pass[i]){
      |            ~~^~~~~~~~~
password.cpp: In function 'std::string guess(int, int)':
password.cpp:21:26: warning: comparison of integer expressions of different signedness: 'int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   21 |             for(int k=0;k<ans.size();k++){
      |                         ~^~~~~~~~~~~
password.cpp:24:31: warning: comparison of integer expressions of different signedness: 'int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   24 |                 if(query(temp)==temp.size()){
      |                    ~~~~~~~~~~~^~~~~~~~~~~~~
password.cpp:33:31: warning: comparison of integer expressions of different signedness: 'int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   33 |                 if(query(temp)==temp.size()){
      |                    ~~~~~~~~~~~^~~~~~~~~~~~~
/usr/bin/ld: /tmp/cchiJQFv.o: in function `query(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >)':
grader.cpp:(.text+0x80): multiple definition of `query(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >)'; /tmp/ccwsBBUx.o:password.cpp:(.text+0x180): first defined here
collect2: error: ld returned 1 exit status