답안 #755945

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
755945 2023-06-10T18:11:29 Z vjudge1 Password (RMI18_password) C++17
0 / 100
442 ms 208 KB
//YOU WILL MAKE IT
#include<bits/stdc++.h>
using namespace std;
int query(string s);
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;
                    break;
                }
            }
                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 'std::string guess(int, int)':
password.cpp:10:26: warning: comparison of integer expressions of different signedness: 'int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   10 |             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:20:31: warning: comparison of integer expressions of different signedness: 'int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   20 |                 if(query(temp)==temp.size()){
      |                    ~~~~~~~~~~~^~~~~~~~~~~~~
password.cpp:9:18: warning: unused variable 'f' [-Wunused-variable]
    9 |             bool f=0;
      |                  ^
# 결과 실행 시간 메모리 Grader output
1 Runtime error 15 ms 208 KB Execution killed with signal 13
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Runtime error 16 ms 208 KB Execution killed with signal 13
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 442 ms 208 KB Could not guess the password with 50000 queries.
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Runtime error 15 ms 208 KB Execution killed with signal 13
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Runtime error 15 ms 208 KB Execution killed with signal 13
2 Halted 0 ms 0 KB -