# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
1054714 | MrAndria | Password (RMI18_password) | C++14 | 0 ms | 596 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 merge(string a,string b){
string s="",pas="";
int curr=b.size()-1;
for(int i=a.size();i>0;i--){
while(curr>=0){
s="";
for(int i1=0;i1<=i-1;i1++){
s.push_back(a[i1]);
}
for(int i1=curr;i<=b.size()-1;i1++){
s.push_back(b[i1]);
}
// cout<<s<<" "<<b.size()<<endl;
if(query(s)==s.size()){
pas.push_back(b[curr]);
curr--;
}else{
break;
}
}
pas.push_back(a[i-1]);
}
// cout<<curr<<endl;
while(curr>=0){
pas+=b[curr];
curr--;
}
reverse(pas.begin(),pas.end());
return pas;
}
string guess(int n, int s){
cin>>n>>s;
string s1;
set <pair <int,string > > se;
int l;
for(int j=1;j<=s;j++){
s1="";
for(int i=1;i<=n;i++){
s1.push_back(char(j+'a'-1));
}
l=query(s1);
s1="";
for(int i=1;i<=l;i++){
s1.push_back(char(j+'a'-1));
}
if(s1.size())se.insert(make_pair(s1.size(),s1));
}
while(se.size()>=2){
auto a=(*(se.begin()));
se.erase(se.begin());
auto b=(*(se.begin()));
se.erase(se.begin());
s1=merge(a.second,b.second);
se.insert(make_pair(s1.size(),s1));
}
if(se.size()==0)assert(0);
return (*(se.begin())).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... |