Submission #642612

#TimeUsernameProblemLanguageResultExecution timeMemory
642612SlavicGPassword (RMI18_password)C++17
Compilation error
0 ms0 KiB
#include "bits/stdc++.h" using namespace std; //int query(string q); string guess(int n, int s) { vector<pair<int, char>> v; for(char c = 'a'; c < (char)('a' + s); ++c) { string paiu = string(n, c); int x = query(paiu); if(x > 0) { v.push_back({x, c}); } } sort(v.begin(), v.end()); string ans = string(v[0].first, v[0].second); v.erase(v.begin()); for(auto x: v) { char c = x.second; int cnt = x.first; vector<int> add((int)ans.size() + 1, 0); for(int i = 0; i <= (int)ans.size() && cnt; ++i) { string bruh = ""; for(int j = 0; j < i; ++j) bruh += ans[j]; for(int j = 0; j < cnt; ++j) bruh += c; for(int j = i; j < (int)ans.size(); ++j) bruh += ans[j]; int qr = query(bruh); add[i] = qr - (int)ans.size(); cnt -= add[i]; } string newans = ""; for(int i = 0; i <= (int)ans.size(); ++i) { for(int j = 0; j < add[i]; ++j) newans += c; if(i < (int)ans.size()) newans += ans[i]; } ans = newans; } return ans; }

Compilation message (stderr)

password.cpp: In function 'std::string guess(int, int)':
password.cpp:10:17: error: 'query' was not declared in this scope
   10 |         int x = query(paiu);
      |                 ^~~~~
password.cpp:27:22: error: 'query' was not declared in this scope
   27 |             int qr = query(bruh);
      |                      ^~~~~