| # | Time | Username | Problem | Language | Result | Execution time | Memory |
|---|---|---|---|---|---|---|---|
| 855643 | franfill | Password (RMI18_password) | C++17 | 1 ms | 432 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);
int query(string S, bool rv)
{
if (rv)
reverse(S.begin(), S.end());
return query(S);
}
string cur = "";
int N, S;
void solve(int i, vector < bool > us, bool rv = false)
{
if (cur.size() == N)
return;
for (int c = 0; c < S; c++)
if (us[c])
{
string tr = cur.substr(0, i);
tr += char('a'+c);
tr += cur.substr(i, cur.size()-i);
if (query(tr, rv) == tr.size())
{
cur = tr;
solve(i, us, rv);
solve(i+1, us, rv);
return;
}
else
us[c] = false;
}
}
string guess(int N, int S)
{
::N = N;
::S = S;
cur = "a";
vector < bool > us(S, true);
for (int c = 0; c < S; c++)
if (query(string(1, c+'a')) == true)
{
cur = string(1, c+'a');
break;
}
else
us[c] = false;
solve(1, us, false);
reverse(cur.begin(), cur.end());
solve(cur.size(), us, true);
reverse(cur.begin(), cur.end());
return cur;
}
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... | ||||
