Submission #755894

#TimeUsernameProblemLanguageResultExecution timeMemory
755894vjudge1Password (RMI18_password)C++17
20 / 100
532 ms300 KiB
///YOU WILL MAKE IT #include<bits/stdc++.h> using namespace std; int query(string s); 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(auto i:mp){ for(int j=0;j<i.second;j++){ for(int k=0;k<=ans.size();k++){ string temp=ans; temp.insert(temp.begin()+k,i.first); // cout<<temp<<" "<<ans<<endl; if(query(temp)==temp.size()){ ans=temp; break; } } } } return ans; }

Compilation message (stderr)

password.cpp: In function 'std::string guess(int, int)':
password.cpp:21:26: warning: comparison of integer expressions of different signedness: 'int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   21 |             for(int k=0;k<=ans.size();k++){
      |                         ~^~~~~~~~~~~~
password.cpp:25:31: warning: comparison of integer expressions of different signedness: 'int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   25 |                 if(query(temp)==temp.size()){
      |                    ~~~~~~~~~~~^~~~~~~~~~~~~
#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...