Submission #1116314

#TimeUsernameProblemLanguageResultExecution timeMemory
1116314BulaPassword (RMI18_password)C++17
0 / 100
157 ms700 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 <= 'z'; 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) / 2; p.clear(); for(int j = 0; j < m; j++) p += t[j]; p += c; if(query(p) == m + 1) r = m; else l = 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...