# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
308913 | 2020-10-02T08:54:05 Z | bigDuck | Password (RMI18_password) | C++14 | 0 ms | 0 KB |
string guess(int n, int s){ string res=""; for(char c='a'; c<=('a'+s-1); c++){ for(int i=0; (i<=res.length()) && (res.length()<n); i++){ string s1="", s2=""; for(int j=0; j<i; j++){ s1+="a"; s1[s1.length()-1]=res[j]; } for(int j=i; j<res.length(); j++){ s2+="a"; s2[s2.length()-1]=res[j]; } string st=""; while(true){ if( (((int)s1.length())+((int)st.length())+((int)s2.length()))==n ){ res=s1+st+s2; i=(((int)s1.length())+((int)st.length())); break; } st+="a"; st[st.length()-1]=c; int ln=query(s1+st+s2); if(ln==(((int)s1.length())+((int)st.length())+((int)s2.length()))){ continue; } else{ st.erase(st.end()-1, st.end()); res=s1+st+s2; i=(((int)s1.length())+((int)st.length())); break; } } } } return res; }