# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
918913 | AtabayRajabli | Password (RMI18_password) | C++17 | 131 ms | 2000 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 s);
string join(string x, string y)
{
int i = x.size();
int j = y.size() - 1;
string res = "";
while(i > 0)
{
while(j >= 0)
{
string q = x.substr(0, i) + y.substr(j);
if(query(q) == q.size())
{
res += y[j--];
}
else break;
}
res += x[i - 1];
i--;
}
while(j >= 0)
res += y[j--];
reverse(res.begin(), res.end());
return res;
}
string guess(int n, int s)
{
priority_queue<pair<int, string>, vector<pair<int, string>>, greater<pair<int, string>>> pq;
for(int i = 0 ; i < s; i++)
{
string x = "";
for(int j = 0; j < n; j++)
x += char('a' + i);
int cnt = query(x);
x.clear();
while(cnt--)
x += char('a' + i);
if(cnt)pq.push({x.size(), x});
}
while(pq.size() > 1)
{
string a = pq.top().second; pq.pop();
string b = pq.top().second; pq.pop();
string r = join(a, b);
pq.push({r.size(), r});
}
return pq.top().second;
}
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... |