Submission #494372

#TimeUsernameProblemLanguageResultExecution timeMemory
494372ItamarPassword (RMI18_password)C++14
Compilation error
0 ms0 KiB
// password.cpp : This file contains the 'main' function. Program execution begins and ends there. // #include <iostream> using namespace std; string rec(int n, int s, string x, int it) { if (x.size() == n) { return x; } for (int i = 0; i < s; i++) { x[it] = 96 + i; if (query(x) == x.size()) { return rec(n, s, x, it + 1); } } x[it] = x[it - 1]; it--; return rec(n, s, x, it); } string guess(int n, int s) { string x; return rec(n, s, x, 0); }

Compilation message (stderr)

password.cpp: In function 'std::string rec(int, int, std::string, int)':
password.cpp:8:15: warning: comparison of integer expressions of different signedness: 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} and 'int' [-Wsign-compare]
    8 |  if (x.size() == n) {
      |      ~~~~~~~~~^~~~
password.cpp:13:7: error: 'query' was not declared in this scope
   13 |   if (query(x) == x.size()) {
      |       ^~~~~