Submission #773221

#TimeUsernameProblemLanguageResultExecution timeMemory
773221TheSahibPassword (RMI18_password)C++14
50 / 100
436 ms452 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 (char 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++){ for(int i = 0; i <= ans.size() && cnt[c - 'a']; ++i){ string z = ans; z.insert(z.begin() + i, c); int b = query(z); if(b == z.size()){ ans = z; cnt[c - 'a']--; } } } return ans; }

Compilation message (stderr)

password.cpp: In function 'std::string guess(int, int)':
password.cpp:36:26: warning: comparison of integer expressions of different signedness: 'int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   36 |         for(int i = 0; i <= ans.size() && cnt[c - 'a']; ++i){
      |                        ~~^~~~~~~~~~~~~
password.cpp:40:18: warning: comparison of integer expressions of different signedness: 'int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   40 |             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...