# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
251362 | shenxy | Password (RMI18_password) | C++14 | 255 ms | 744 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 <algorithm>
#include <string>
using namespace std;
int cnt[26];
int query(string str);
string dnc(int s, int e) {
if (s == e) {
string ans = "";
for (int i = 0; i < cnt[s]; ++i) ans.push_back('a' + s);
return ans;
}
string l = dnc(s, (s + e) / 2), r = dnc((s + e) / 2 + 1, e);
int ptr = 0;
for (char c: r) {
string x = l;
x.insert(ptr, 1, c);
while (query(x) != x.length()) x = l, x.insert(++ptr, 1, c);
l = x;
++ptr;
}
return l;
}
string guess(int N, int S) {
for (int i = 0; i < S; ++i) {
string Q = "";
for (int j = 0; j < N; ++j) Q.push_back('a' + i);
cnt[i] = query(Q);
}
return dnc(0, S - 1);
}
Compilation message (stderr)
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |