# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
755966 | vjudge1 | Password (RMI18_password) | C++17 | 0 ms | 0 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.
///YOU WILL MAKE IT
#include<bits/stdc++.h>
using namespace std;
int query(string s){
int p1=0;
string pass="abbb";
for(int i=0;i<s.size();i++){
if(p1<s.size()&&s[p1]==pass[i]){
p1++;
}
}
return p1;
};
string guess(int n,int s){
string cur="";
map<char,int> mp;
for(int i=0;i<s;i++){
string cur="";
cur+=('a'+i);
for(int j=1;j<=n;j++){
if(query(cur)==j){
mp[(i+'a')]++;
cur+=(i+'a');
}
}
}
string ans="";
for(int j=0;j<s;j++){
bool f=1;
// int val=0;
for(int k=0;k<ans.size();k++){
string temp=ans;
//cout<<ans<<" "<<" "<<k<<" "<<temp<<endl;
temp.insert(temp.begin()+k,(char)(j+'a'));
if(query(temp)==temp.size()){
ans=temp;
}
}
while(f){
f=0;
string temp=ans;
temp.push_back((char)(j+'a'));
if(query(temp)==temp.size()){
ans=temp;
f=1;
}
}
}
return ans;
}
int main(){
cout<<guess(4,2);
}