답안 #755993

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
755993 2023-06-10T19:40:44 Z vjudge1 Password (RMI18_password) C++17
0 / 100
55 ms 316 KB
#include<bits/stdc++.h>
using namespace std;
int query(string s);
string guess(int n,int s){
    string ans="";
        for(int j=0;j<s;j++){
            bool f=1;
            char cur=(char)(j+'a');
            for(int k=0;k<ans.size();k++){
                string temp=ans;
                //cout<<ans<<" "<<" "<<k<<" "<<temp<<endl;
                temp.insert(temp.begin()+k,cur);
                if(query(temp)==temp.size()){
                    ans=temp;
                }
            }
            while(f&&ans.size()<n){
                    f=0;
               string temp=ans;
                temp.push_back(cur);
                if(query(temp)==temp.size()){
                    ans=temp;
                    f=1;
                }
            }
        }
    return ans;
}

Compilation message

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