# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
852997 | allin27x | Password (RMI18_password) | C++17 | 173 ms | 1732 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 guess(int n, int s){
string res;
vector<int> nc(s, 0);
for (int i=0; i<s; i++) nc[i] = query(string(n,'a'+i));
while (res.size()<n){
string rev = res; reverse(rev.begin(), rev.end());
int mx = -1; for (int i=0; i<s; i++) if (nc[i]) {mx = i; break;}
for (int i=mx+1; i<s; i++){
if (!nc[i]) continue;
if (query(string(nc[i], 'a'+i) + string(1,'a'+mx) + rev) != nc[i] + 1 + res.size()) mx = i;
}
nc[mx] --; res += 'a' + mx;
}
reverse(res.begin(), res.end());
return res;
}
//aabcba
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... |