# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
248800 | tqbfjotld | Password (RMI18_password) | C++14 | 416 ms | 616 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);
bool cmp(string s1, string s2){
return s1.size()>s2.size();
}
priority_queue<string,vector<string>,function<bool(string,string)> > pq(cmp);
string repeat(char c, int n){
string ret = "";
for (int x = 0; x<n; x++){
ret+=c;
}
return ret;
}
string guess(int n, int s){
for (int x = 0; x<s; x++){
string qu = repeat('a'+x,n);
int t = query(qu);
if (t!=0)pq.push(repeat('a'+x,t));
}
while (pq.size()>1){
string s1 = pq.top(); pq.pop();
string s2 = pq.top(); pq.pop();
string nw = "";
nw+=s2[0];
int c1 = 0;
int c2 = 1;
while (nw.size()<s1.size()+s2.size()){
string qu = nw+s1.substr(c1,s1.size());
int t = query(qu);
if (t==qu.size()){
if (c2==s2.size()){
nw += s1.substr(c1,s1.size());
}
else{
nw += s2[c2];
c2++;
}
}
else{
nw.pop_back();
c2--;
nw += s1[c1];
c1++;
}
}
pq.push(nw);
}
return pq.top();
}
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... |