# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
333358 | valerikk | Password (RMI18_password) | C++17 | 0 ms | 0 KiB |
This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#include <bits/stdc++.h>
using namespace std;
int query(string str);
string pushs(string s, char x) {
s.push_back(x);
return s;
}
string inserts(string s, int pos, char x) {
insert(s.begin() + pos, x);
return s;
}
string go(int l, int r) {
if (r - l == 1) {
string s = "";
char x = 'a' + l;
while (query(pushs(s, x)) == s.size() + 1) s.push_back(x);
return s;
}
int mid = (l + r) / 2;
auto s = go(l, mid), t = go(mid, r);
for (int i = 0, j = 0; i <= s.size() && j < t.size(); ++i) {
string kek = inserts(s, i, t[j]);
if (query(kek) == kek.size()) s = kek;
}
return s;
}
string guess(int n, int s) {
return go(0, s);
}