답안 #755967

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
755967 2023-06-10T18:48:33 Z vjudge1 Password (RMI18_password) C++17
0 / 100
99 ms 320 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++){
        string cur="";
        cur+=('a'+i);
        for(int j=1;j<=n;j++){
            if(query(cur)==j){
                mp[(i+'a')]++;
                cur+=(i+'a');
            }
        }
    }
    string ans="";
        for(int j=0;j<s;j++){
            bool f=1;
           // int val=0;
            for(int k=0;k<ans.size();k++){
                string temp=ans;
                //cout<<ans<<" "<<" "<<k<<" "<<temp<<endl;
                temp.insert(temp.begin()+k,(char)(j+'a'));
                if(query(temp)==temp.size()){
                    ans=temp;
                }
            }
            while(f){
                    f=0;
               string temp=ans;
                temp.push_back((char)(j+'a'));
                if(query(temp)==temp.size()){
                    ans=temp;
                    f=1;
                }
            }
        }
    return ans;
}

Compilation message

password.cpp: In function 'std::string guess(int, int)':
password.cpp:22:26: warning: comparison of integer expressions of different signedness: 'int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   22 |             for(int k=0;k<ans.size();k++){
      |                         ~^~~~~~~~~~~
password.cpp:26:31: warning: comparison of integer expressions of different signedness: 'int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   26 |                 if(query(temp)==temp.size()){
      |                    ~~~~~~~~~~~^~~~~~~~~~~~~
password.cpp:34:31: warning: comparison of integer expressions of different signedness: 'int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   34 |                 if(query(temp)==temp.size()){
      |                    ~~~~~~~~~~~^~~~~~~~~~~~~
# 결과 실행 시간 메모리 Grader output
1 Runtime error 5 ms 208 KB Execution killed with signal 13
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Runtime error 2 ms 208 KB Execution killed with signal 13
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Runtime error 99 ms 320 KB Execution killed with signal 13
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Runtime error 5 ms 208 KB Execution killed with signal 13
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Runtime error 5 ms 208 KB Execution killed with signal 13
2 Halted 0 ms 0 KB -