Submission #199690

#TimeUsernameProblemLanguageResultExecution timeMemory
199690zoooma13Password (RMI18_password)C++14
100 / 100
357 ms748 KiB
#include <bits/stdc++.h> using namespace std; int query(string s); string merge(string s ,string t){ for(int j=(int)s.size(),i=(int)t.size()-1; ~i; i--){ while(true){ string q = s; q.insert(q.begin()+j ,t[i]); if(query(q) == q.size()){ s = q; break; } j--; } } return s; } string guess(int n ,int s){ vector <string> vs; for(int x,i=0; i<s; i++){ x = query(string(n ,'a'+i)); if(x) vs.push_back(string(x ,'a'+i)); } while(vs.size()>1){ sort(vs.begin() ,vs.end() ,[](string s ,string t){ return s.size() > t.size(); }); string x = vs.back(); vs.pop_back(); string y = vs.back(); vs.pop_back(); vs.push_back(merge(x ,y)); } return vs.front(); }

Compilation message (stderr)

password.cpp: In function 'std::__cxx11::string merge(std::__cxx11::string, std::__cxx11::string)':
password.cpp:11:25: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
             if(query(q) == q.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...