Submission #773206

#TimeUsernameProblemLanguageResultExecution timeMemory
773206TheSahibPassword (RMI18_password)C++14
30 / 100
349 ms428 KiB
#include <bits/stdc++.h> #define ll long long #define pii pair<int, int> using namespace std; int cnt[30]; int query(string s); string guess(int n, int s){ for (int c = 'a'; c < 'a' + s; c++) { string a; for (int i = 0; i < n; i++) { a += c; } int b = query(a); cnt[c - 'a'] = b; } string ans; char c = 'a'; for (; c < 'a' + s; c++) { if(cnt[c - 'a'] == 0) continue; while(cnt[c - 'a']--){ ans += c; } c += 1; break; } for(; c < 'a' + s; c++){ while(cnt[c - 'a']--){ for(int i = 0; i <= ans.size(); ++i){ string z = ans; z.insert(z.begin() + i, c); int b = query(z); if(b == z.size()){ ans = z; break; } } } } return ans; }

Compilation message (stderr)

password.cpp: In function 'std::string guess(int, int)':
password.cpp:37:30: warning: comparison of integer expressions of different signedness: 'int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   37 |             for(int i = 0; i <= ans.size(); ++i){
      |                            ~~^~~~~~~~~~~~~
password.cpp:41:22: warning: comparison of integer expressions of different signedness: 'int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   41 |                 if(b == z.size()){
      |                    ~~^~~~~~~~~~~
#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...