Submission #1117312

#TimeUsernameProblemLanguageResultExecution timeMemory
1117312plescagheorghe07Password (RMI18_password)C++17
0 / 100
1000 ms336 KiB
#include <iostream> #include <vector> #include <map> #include <string> #include <algorithm> #include <unistd.h> #include <fstream> using namespace std; int query( string s ); string guess(int n, int s) { string chars = ""; string result = ""; for (int i = 0; i < s; ++i) chars += char('a' + i); int last_match = 0; while (result.size() < n) { for (char c : chars) { string temp = result + c; int curr_match = query(temp); if (curr_match > last_match) { result += c; last_match = curr_match; break; } } } return result; }

Compilation message (stderr)

password.cpp: In function 'std::string guess(int, int)':
password.cpp:20:26: warning: comparison of integer expressions of different signedness: 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} and 'int' [-Wsign-compare]
   20 |     while (result.size() < n) {
      |            ~~~~~~~~~~~~~~^~~
#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...