Submission #333344

# Submission time Handle Problem Language Result Execution time Memory
333344 2020-12-05T16:38:23 Z valerikk Password (RMI18_password) C++17
Compilation error
0 ms 0 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++) {
                cur.insert(cur.begin() + i, x);
                if (query(cur) == cur.size()) was = true; else cur.erase(cur.begin() + i);
            }
            if (!was) break;
        }
        res.push_back(cur[i]);
    }
    return ans;
}

Compilation message

password.cpp: In function 'std::string guess(int, int)':
password.cpp:14:32: warning: comparison of integer expressions of different signedness: 'int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   14 |                 if (query(cur) == cur.size()) was = true; else cur.erase(cur.begin() + i);
      |                     ~~~~~~~~~~~^~~~~~~~~~~~~
password.cpp:20:12: error: 'ans' was not declared in this scope; did you mean 'abs'?
   20 |     return ans;
      |            ^~~
      |            abs