Submission #333348

# Submission time Handle Problem Language Result Execution time Memory
333348 2020-12-05T16:42:16 Z valerikk Password (RMI18_password) C++17
0 / 100
164 ms 504 KB
#include <bits/stdc++.h>
using namespace std;

int query(string str);

string guess(int n, int s) {
    string cur = "";
    string res = "";
    for (int i = 0; i < n; i++) {
        while (true) {
            bool was = false;
            for (char x = 'a'; x < 'a' + s; x++) {
                if (cur.size() < i) return "fuck";
                cur.insert(cur.begin() + i, x);
                if (query(cur) == cur.size()) was = true; else cur.erase(cur.begin() + i);
            }
            if (!was) break;
        }
        if (cur.size() <= i) return "fuck";
        res.push_back(cur[i]);
    }
    return res;
}

Compilation message

password.cpp: In function 'std::string guess(int, int)':
password.cpp:13:32: warning: comparison of integer expressions of different signedness: 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} and 'int' [-Wsign-compare]
   13 |                 if (cur.size() < i) return "fuck";
      |                     ~~~~~~~~~~~^~~
password.cpp:15:32: warning: comparison of integer expressions of different signedness: 'int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   15 |                 if (query(cur) == cur.size()) was = true; else cur.erase(cur.begin() + i);
      |                     ~~~~~~~~~~~^~~~~~~~~~~~~
password.cpp:19:24: warning: comparison of integer expressions of different signedness: 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} and 'int' [-Wsign-compare]
   19 |         if (cur.size() <= i) return "fuck";
      |             ~~~~~~~~~~~^~~~
# Verdict Execution time Memory Grader output
1 Runtime error 4 ms 364 KB Execution killed with signal 13 (could be triggered by violating memory limits)
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 3 ms 384 KB Execution killed with signal 13 (could be triggered by violating memory limits)
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 164 ms 504 KB Execution killed with signal 13 (could be triggered by violating memory limits)
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 4 ms 364 KB Execution killed with signal 13 (could be triggered by violating memory limits)
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 4 ms 364 KB Execution killed with signal 13 (could be triggered by violating memory limits)
2 Halted 0 ms 0 KB -