Submission #773320

#TimeUsernameProblemLanguageResultExecution timeMemory
773320TheSahibPassword (RMI18_password)C++14
30 / 100
180 ms344 KiB
#include <bits/stdc++.h> #define ll long long #define pii pair<int, int> using namespace std; int query(string s); string merge(string s1, string s2){ int p = 0; string ans = s1; for (int i = 0; i <= ans.size() && p < s2.size(); i++) { string z = ans; z.insert(z.begin() + i, s2[p]); int b = query(z); if(b == z.size()){ ans = z; p++; i -= 1; } } return ans; } string guess(int n, int s){ vector<string> ss; for (int c = 'a'; c < 'a' + s; c++) { string a; for (int i = 0; i < n; i++) { a += c; } int b = query(a); a.erase(a.begin() + b, a.end()); if(a.empty()) continue; ss.push_back(a); } while(ss.size() != 1){ sort(ss.begin(), ss.end()); string a = merge(ss[ss.size() - 1], ss[ss.size() - 2]); ss.pop_back(); ss.pop_back(); ss.push_back(a); } return ss[0]; }

Compilation message (stderr)

password.cpp: In function 'std::string merge(std::string, std::string)':
password.cpp:13:23: warning: comparison of integer expressions of different signedness: 'int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   13 |     for (int i = 0; i <= ans.size() && p < s2.size(); i++)
      |                     ~~^~~~~~~~~~~~~
password.cpp:13:42: warning: comparison of integer expressions of different signedness: 'int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   13 |     for (int i = 0; i <= ans.size() && p < s2.size(); i++)
      |                                        ~~^~~~~~~~~~~
password.cpp:18:14: warning: comparison of integer expressions of different signedness: 'int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   18 |         if(b == z.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...