Submission #755900

# Submission time Handle Problem Language Result Execution time Memory
755900 2023-06-10T17:31:04 Z vjudge1 Password (RMI18_password) C++17
30 / 100
433 ms 408 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(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){
                ans.push_back(i.first);
            }
        }
    }
    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:25:31: warning: comparison of integer expressions of different signedness: 'int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   25 |                 if(query(temp)==temp.size()){
      |                    ~~~~~~~~~~~^~~~~~~~~~~~~
# Verdict Execution time Memory Grader output
1 Correct 3 ms 208 KB Guessed the password with 284 queries.
2 Correct 6 ms 208 KB Guessed the password with 690 queries.
# Verdict Execution time Memory Grader output
1 Correct 6 ms 208 KB Guessed the password with 572 queries.
2 Correct 11 ms 208 KB Guessed the password with 970 queries.
3 Correct 5 ms 208 KB Guessed the password with 378 queries.
4 Correct 36 ms 208 KB Guessed the password with 3342 queries.
# Verdict Execution time Memory Grader output
1 Incorrect 433 ms 408 KB Could not guess the password with 50000 queries.
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 3 ms 208 KB Guessed the password with 284 queries.
2 Correct 6 ms 208 KB Guessed the password with 690 queries.
3 Correct 6 ms 208 KB Guessed the password with 572 queries.
4 Correct 11 ms 208 KB Guessed the password with 970 queries.
5 Correct 5 ms 208 KB Guessed the password with 378 queries.
6 Correct 36 ms 208 KB Guessed the password with 3342 queries.
7 Incorrect 433 ms 408 KB Could not guess the password with 50000 queries.
8 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 3 ms 208 KB Guessed the password with 284 queries.
2 Correct 6 ms 208 KB Guessed the password with 690 queries.
3 Correct 6 ms 208 KB Guessed the password with 572 queries.
4 Correct 11 ms 208 KB Guessed the password with 970 queries.
5 Correct 5 ms 208 KB Guessed the password with 378 queries.
6 Correct 36 ms 208 KB Guessed the password with 3342 queries.
7 Incorrect 433 ms 408 KB Could not guess the password with 50000 queries.
8 Halted 0 ms 0 KB -