Submission #333339

# Submission time Handle Problem Language Result Execution time Memory
333339 2020-12-05T16:29:51 Z valerikk Password (RMI18_password) C++17
10 / 100
97 ms 620 KB
#include <bits/stdc++.h>
using namespace std;

int query(string str);

string guess(int n, int s) {
    string ans = "";
    for (int i = 0; i < n; ++i) {
        for (char x = 'a'; x < 'a' + s; x++) {
            if (ans.size() < n) {
                ans.insert(ans.begin() + i, {x});
                if (query(ans) != ans.size()) ans.erase(ans.begin() + i, ans.begin() + i + 1);
            }
        }
    }
    return ans;
}

Compilation message

password.cpp: In function 'std::string guess(int, int)':
password.cpp:10:28: warning: comparison of integer expressions of different signedness: 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} and 'int' [-Wsign-compare]
   10 |             if (ans.size() < n) {
      |                 ~~~~~~~~~~~^~~
password.cpp:12:32: warning: comparison of integer expressions of different signedness: 'int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   12 |                 if (query(ans) != ans.size()) ans.erase(ans.begin() + i, ans.begin() + i + 1);
      |                     ~~~~~~~~~~~^~~~~~~~~~~~~
# Verdict Execution time Memory Grader output
1 Correct 3 ms 364 KB Guessed the password with 210 queries.
2 Correct 5 ms 364 KB Guessed the password with 482 queries.
# Verdict Execution time Memory Grader output
1 Runtime error 4 ms 620 KB Execution killed with signal 6 (could be triggered by violating memory limits)
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 97 ms 620 KB Execution killed with signal 6 (could be triggered by violating memory limits)
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 3 ms 364 KB Guessed the password with 210 queries.
2 Correct 5 ms 364 KB Guessed the password with 482 queries.
3 Runtime error 4 ms 620 KB Execution killed with signal 6 (could be triggered by violating memory limits)
4 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 3 ms 364 KB Guessed the password with 210 queries.
2 Correct 5 ms 364 KB Guessed the password with 482 queries.
3 Runtime error 4 ms 620 KB Execution killed with signal 6 (could be triggered by violating memory limits)
4 Halted 0 ms 0 KB -