Submission #645249

#TimeUsernameProblemLanguageResultExecution timeMemory
645249alexddPassword (RMI18_password)C++17
0 / 100
247 ms532 KiB
#include<iostream> #include<unordered_map> using namespace std; int query(string str); unordered_map<string,int> umap; int intreaba(string str) { if(str=="") return 0; //if(umap.count(str)==0) // umap[str]=query(str); //return umap[str]; return query(str); } string tochar(int ch) { char ceva=ch+'a'; string nush=""; nush=nush+ceva; return nush; } string guess(int n, int s) { umap.clear(); string rez=""; for(int i=1;i<n;i++) { for(int ch=0;ch<s;ch++) { if(intreaba(rez+tochar(ch))==intreaba(rez)) continue; bool bl=0; for(int bd=0;bd<s;bd++) { if(bd==ch) continue; if(intreaba(rez+tochar(ch))<intreaba(rez+tochar(bd)+tochar(ch))) { bl=1; break; } } if(bl==0) { rez=rez+tochar(ch); break; } } } for(int ch=0;ch<s;ch++) { if(intreaba(rez+tochar(ch))==n) { return rez+tochar(ch); } } }

Compilation message (stderr)

password.cpp: In function 'std::string guess(int, int)':
password.cpp:25:16: warning: control reaches end of non-void function [-Wreturn-type]
   25 |     string rez="";
      |                ^~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...