Submission #755904

# Submission time Handle Problem Language Result Execution time Memory
755904 2023-06-10T17:33:44 Z vjudge1 Password (RMI18_password) C++17
50 / 100
1045 ms 320 KB
#include <bits/stdc++.h>
 
        using namespace std;
 
        string st; int k;
        int query(string str);
 
        string guess(int n, int s) {
            string S(n, 'a');
            int freq[s]{0};
            for(int l = 0; l < s; l++) {
                for(int i = 0; i < n; i++)
                    S[i] = char('a' + l);
                freq[l] = query(S);
            }
            S = "";
            for(int l = 0; l < s; l++) {
                for(int i = 0, last = 0; i < freq[l]; i++) {
                    for(;; last++) {
                        string str = "";
                        for(int e = 0; e < last; e++) str.push_back(S[e]);
                        str.push_back(char('a' + l));
                        for(int e = last; e < S.size(); e++)
                            str.push_back(S[e]);
                        if(query(str) == str.size()) {
                            S = str; last++; break;
                        }
                    }
                }
            }
            return S;
        }

Compilation message

password.cpp: In function 'std::string guess(int, int)':
password.cpp:23:45: warning: comparison of integer expressions of different signedness: 'int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   23 |                         for(int e = last; e < S.size(); e++)
      |                                           ~~^~~~~~~~~~
password.cpp:25:39: 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(str) == str.size()) {
      |                            ~~~~~~~~~~~^~~~~~~~~~~~~
# Verdict Execution time Memory Grader output
1 Correct 1 ms 208 KB Guessed the password with 77 queries.
2 Correct 2 ms 208 KB Guessed the password with 188 queries.
# Verdict Execution time Memory Grader output
1 Correct 1 ms 208 KB Guessed the password with 72 queries.
2 Correct 2 ms 208 KB Guessed the password with 164 queries.
3 Correct 1 ms 208 KB Guessed the password with 103 queries.
4 Correct 2 ms 208 KB Guessed the password with 229 queries.
# Verdict Execution time Memory Grader output
1 Correct 66 ms 304 KB Guessed the password with 4581 queries.
2 Correct 117 ms 316 KB Guessed the password with 10303 queries.
3 Correct 183 ms 296 KB Guessed the password with 12561 queries.
4 Correct 332 ms 320 KB Guessed the password with 20501 queries.
# Verdict Execution time Memory Grader output
1 Correct 1 ms 208 KB Guessed the password with 77 queries.
2 Correct 2 ms 208 KB Guessed the password with 188 queries.
3 Correct 1 ms 208 KB Guessed the password with 72 queries.
4 Correct 2 ms 208 KB Guessed the password with 164 queries.
5 Correct 1 ms 208 KB Guessed the password with 103 queries.
6 Correct 2 ms 208 KB Guessed the password with 229 queries.
7 Correct 66 ms 304 KB Guessed the password with 4581 queries.
8 Correct 117 ms 316 KB Guessed the password with 10303 queries.
9 Correct 183 ms 296 KB Guessed the password with 12561 queries.
10 Correct 332 ms 320 KB Guessed the password with 20501 queries.
11 Incorrect 1045 ms 320 KB Could not guess the password with 50000 queries.
12 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1 ms 208 KB Guessed the password with 77 queries.
2 Correct 2 ms 208 KB Guessed the password with 188 queries.
3 Correct 1 ms 208 KB Guessed the password with 72 queries.
4 Correct 2 ms 208 KB Guessed the password with 164 queries.
5 Correct 1 ms 208 KB Guessed the password with 103 queries.
6 Correct 2 ms 208 KB Guessed the password with 229 queries.
7 Correct 66 ms 304 KB Guessed the password with 4581 queries.
8 Correct 117 ms 316 KB Guessed the password with 10303 queries.
9 Correct 183 ms 296 KB Guessed the password with 12561 queries.
10 Correct 332 ms 320 KB Guessed the password with 20501 queries.
11 Incorrect 1045 ms 320 KB Could not guess the password with 50000 queries.
12 Halted 0 ms 0 KB -