Submission #1156778

#TimeUsernameProblemLanguageResultExecution timeMemory
1156778SmuggingSpunPassword (RMI18_password)C++20
Compilation error
0 ms0 KiB
#include<bits/stdc++.h> using namespace std; string guess(int n, int s){ if(n <= s || (n <= 100 && s <= 4)){ string ans = ""; for(int i = 0, bef = 0; i < n; i++){ for(int j = 0; j <= i; j++){ for(int k = 0; k < s; k++){ string candidate = ans.substr(0, j) + char('a' + k) + ans.substr(j, i - j); if(query(ans.substr(0, j) + char('a' + k) + ans.substr(j, i - j)) == bef + 1){ bef++; swap(ans, candidate); j = i; break; } } } } return ans; } }

Compilation message (stderr)

password.cpp: In function 'std::string guess(int, int)':
password.cpp:10:44: error: 'query' was not declared in this scope
   10 |                                         if(query(ans.substr(0, j) + char('a' + k) + ans.substr(j, i - j)) == bef + 1){
      |                                            ^~~~~
password.cpp:21:1: warning: control reaches end of non-void function [-Wreturn-type]
   21 | }
      | ^