Submission #848783

#TimeUsernameProblemLanguageResultExecution timeMemory
848783TahirAliyevPassword (RMI18_password)C++17
50 / 100
305 ms1476 KiB
#include <bits/stdc++.h> using namespace std; int query(string str); vector<string> v; string merge(string a, string b){ int p1 = 0, p2 = 0; while(p1 <= a.size() && p2 < b.size()){ string q = a; q.insert(q.begin() + p1, b[p2]); if(query(q) == q.size()){ a = q; p2++; } else{ p1++; } } return a; } string guess(int n, int s){ for(char c = 'a'; c <= 'a' + s - 1; c++){ string s = ""; for(int i = 1; i <= n; i++){ s += c; } int cnt = query(s); s = ""; for(int i = 1; i <= cnt; i++){ s += c; } v.push_back(s); } string main = v[0]; for(int i = 1; i < v.size(); i++){ main = merge(main, v[i]); } return main; }

Compilation message (stderr)

password.cpp: In function 'std::string merge(std::string, std::string)':
password.cpp:11:14: warning: comparison of integer expressions of different signedness: 'int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   11 |     while(p1 <= a.size() && p2 < b.size()){
      |           ~~~^~~~~~~~~~~
password.cpp:11:32: warning: comparison of integer expressions of different signedness: 'int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   11 |     while(p1 <= a.size() && p2 < b.size()){
      |                             ~~~^~~~~~~~~~
password.cpp:14:21: warning: comparison of integer expressions of different signedness: 'int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   14 |         if(query(q) == q.size()){
      |            ~~~~~~~~~^~~~~~~~~~~
password.cpp: In function 'std::string guess(int, int)':
password.cpp:39:22: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<std::__cxx11::basic_string<char> >::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   39 |     for(int i = 1; i < v.size(); i++){
      |                    ~~^~~~~~~~~~
#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...