답안 #709240

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
709240 2023-03-13T09:15:04 Z siewjh Password (RMI18_password) C++17
50 / 100
356 ms 420 KB
#include <bits/stdc++.h>
using namespace std;

int query(string q);

string guess(int n, int s){
    string ans = "";
    for (int i = 0; i < s; i++){
        char ch = 'a' + i;
        string str = "";
        for (int k = 0; k < n; k++) str += ch;
        int amt = query(str);
        for (int ind = 0, j = 0; j < amt; j++){
            for (;;ind++){
                str = ans;
                str.insert(str.begin() + ind, ch);
                if (query(str) == str.size()) {
                    ans = str;
                    ind++;
                    break;
                }
            }
        }
    }
    return ans;
}

Compilation message

password.cpp: In function 'std::string guess(int, int)':
password.cpp:17:32: warning: comparison of integer expressions of different signedness: 'int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   17 |                 if (query(str) == str.size()) {
      |                     ~~~~~~~~~~~^~~~~~~~~~~~~
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 208 KB Guessed the password with 77 queries.
2 Correct 3 ms 208 KB Guessed the password with 188 queries.
# 결과 실행 시간 메모리 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 2 ms 208 KB Guessed the password with 103 queries.
4 Correct 3 ms 208 KB Guessed the password with 229 queries.
# 결과 실행 시간 메모리 Grader output
1 Correct 49 ms 296 KB Guessed the password with 4581 queries.
2 Correct 81 ms 420 KB Guessed the password with 10303 queries.
3 Correct 100 ms 308 KB Guessed the password with 12561 queries.
4 Correct 112 ms 320 KB Guessed the password with 20501 queries.
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 208 KB Guessed the password with 77 queries.
2 Correct 3 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 2 ms 208 KB Guessed the password with 103 queries.
6 Correct 3 ms 208 KB Guessed the password with 229 queries.
7 Correct 49 ms 296 KB Guessed the password with 4581 queries.
8 Correct 81 ms 420 KB Guessed the password with 10303 queries.
9 Correct 100 ms 308 KB Guessed the password with 12561 queries.
10 Correct 112 ms 320 KB Guessed the password with 20501 queries.
11 Incorrect 356 ms 324 KB Could not guess the password with 50000 queries.
12 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 208 KB Guessed the password with 77 queries.
2 Correct 3 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 2 ms 208 KB Guessed the password with 103 queries.
6 Correct 3 ms 208 KB Guessed the password with 229 queries.
7 Correct 49 ms 296 KB Guessed the password with 4581 queries.
8 Correct 81 ms 420 KB Guessed the password with 10303 queries.
9 Correct 100 ms 308 KB Guessed the password with 12561 queries.
10 Correct 112 ms 320 KB Guessed the password with 20501 queries.
11 Incorrect 356 ms 324 KB Could not guess the password with 50000 queries.
12 Halted 0 ms 0 KB -