Submission #773223

#TimeUsernameProblemLanguageResultExecution timeMemory
773223aykhnPassword (RMI18_password)C++14
50 / 100
267 ms356 KiB
#include <bits/stdc++.h> // author: aykhn using namespace std; typedef long long ll; int query(string str); string guess(int n, int s) { string ans = ""; int prev = 0; for (int i = 0; i < s; i++) { for (int j = 0; j <= ans.length(); j++) { string bfr = ans; ans.insert(ans.begin() + j, 'a' + i); int x = query(ans); if (x <= prev) ans = bfr; else prev = x; if (ans.length() == n) break; } if (ans.length() == n) break; } return ans; }

Compilation message (stderr)

password.cpp: In function 'std::string guess(int, int)':
password.cpp:18:27: warning: comparison of integer expressions of different signedness: 'int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   18 |         for (int j = 0; j <= ans.length(); j++)
      |                         ~~^~~~~~~~~~~~~~~
password.cpp:27:30: warning: comparison of integer expressions of different signedness: 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} and 'int' [-Wsign-compare]
   27 |             if (ans.length() == n) break;
      |                 ~~~~~~~~~~~~~^~~~
password.cpp:29:26: warning: comparison of integer expressions of different signedness: 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} and 'int' [-Wsign-compare]
   29 |         if (ans.length() == n) break;
      |             ~~~~~~~~~~~~~^~~~
#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...