Submission #1116319

#TimeUsernameProblemLanguageResultExecution timeMemory
1116319BulaPassword (RMI18_password)C++17
10 / 100
173 ms692 KiB
#include<bits/stdc++.h> using namespace std; int query(string p); string guess(int n, int s){ string t; for(char c = 'a'; c <= 'a' + s - 1; c++){ string p; for(int i = 0; i < n; i++) p += c; int x = query(p); for(int i = 0; i < x; i++){ int l = 0, r = t.size(); while(l < r){ int m = (l + r + 1) / 2; p.clear(); for(int j = 0; j < m; j++) p += t[j]; p += c; if(query(p) == m + 1) l = m; else r = m - 1; } p.clear(); for(int j = 0; j < l; j++) p += t[j]; p += c; for(int j = l; j < t.size(); j++) p += t[j]; t = p; } } return t; }

Compilation message (stderr)

password.cpp: In function 'std::string guess(int, int)':
password.cpp:23:30: warning: comparison of integer expressions of different signedness: 'int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   23 |             for(int j = l; j < t.size(); j++) p += t[j];
      |                            ~~^~~~~~~~~~
#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...