답안 #1117312

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
1117312 2024-11-23T09:50:33 Z plescagheorghe07 Password (RMI18_password) C++17
0 / 100
1000 ms 336 KB
#include <iostream>
#include <vector>
#include <map>
#include <string>
#include <algorithm>
#include <unistd.h>
#include <fstream>

using namespace std;


int query( string s );
string guess(int n, int s) {
    string chars = "";
    string result = "";
    for (int i = 0; i < s; ++i)
        chars += char('a' + i);

    int last_match = 0;
    while (result.size() < n) {
        for (char c : chars) {
            string temp = result + c;
            int curr_match = query(temp);
            if (curr_match > last_match) {
                result += c;
                last_match = curr_match;
                break;
            }
        }
    }
    return result;
}


Compilation message

password.cpp: In function 'std::string guess(int, int)':
password.cpp:20:26: warning: comparison of integer expressions of different signedness: 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} and 'int' [-Wsign-compare]
   20 |     while (result.size() < n) {
      |            ~~~~~~~~~~~~~~^~~
# 결과 실행 시간 메모리 Grader output
1 Incorrect 948 ms 336 KB Could not guess the password with 50000 queries.
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 1000 ms 336 KB Could not guess the password with 50000 queries.
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 991 ms 336 KB Could not guess the password with 50000 queries.
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 948 ms 336 KB Could not guess the password with 50000 queries.
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 948 ms 336 KB Could not guess the password with 50000 queries.
2 Halted 0 ms 0 KB -