Submission #755947

# Submission time Handle Problem Language Result Execution time Memory
755947 2023-06-10T18:13:44 Z vjudge1 Password (RMI18_password) C++17
0 / 100
1 ms 300 KB
///YOU WILL MAKE IT
#include<bits/stdc++.h>
using namespace std;
int query(string s);
string guess(int n,int s){
    string cur="";
    map<char,int> mp;
    for(int i=0;i<s;i++){
        mp[i]=n;
    }
    string ans="";
    for(auto i:mp){
        for(int j=0;j<i.second;j++){
            bool f=0;
            for(int k=0;k<ans.size();k++){
                string temp=ans;
                temp.insert(temp.begin()+k,i.first);
                if(query(temp)==temp.size()){
                    ans=temp;
                    f=1;
                    break;
                }
            }
            if(!f){
                string temp=ans;
                temp.push_back(i.first);
                if(query(temp)==temp.size()){
                    ans=temp;
                    f=1;
                   // break;
                }
            }
        }
    }
    return ans;
}

Compilation message

password.cpp: In function 'std::string guess(int, int)':
password.cpp:15:26: warning: comparison of integer expressions of different signedness: 'int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   15 |             for(int k=0;k<ans.size();k++){
      |                         ~^~~~~~~~~~~
password.cpp:18:31: warning: comparison of integer expressions of different signedness: 'int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   18 |                 if(query(temp)==temp.size()){
      |                    ~~~~~~~~~~~^~~~~~~~~~~~~
password.cpp:27:31: warning: comparison of integer expressions of different signedness: 'int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   27 |                 if(query(temp)==temp.size()){
      |                    ~~~~~~~~~~~^~~~~~~~~~~~~
# Verdict Execution time Memory Grader output
1 Runtime error 0 ms 208 KB Execution killed with signal 13
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 1 ms 208 KB Execution killed with signal 13
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 1 ms 300 KB Execution killed with signal 13
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 0 ms 208 KB Execution killed with signal 13
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 0 ms 208 KB Execution killed with signal 13
2 Halted 0 ms 0 KB -