Submission #855667

#TimeUsernameProblemLanguageResultExecution timeMemory
855667franfillPassword (RMI18_password)C++17
50 / 100
260 ms1792 KiB
#include<bits/stdc++.h> using namespace std; int query(string S); string cur = ""; int N, S; void solve(int i, vector < bool > us) { if (cur.size() == N) return; for (int c = 0; c < S; c++) if (us[c]) { string tr = cur.substr(0, i); tr += char('a'+c); tr += cur.substr(i, cur.size()-i); if (query(tr) == tr.size()) { cur = tr; solve(i+1, us); solve(i, us); return; } else us[c] = false; } } string guess(int N, int S) { ::N = N; ::S = S; cur = ""; vector < bool > us(S, true); solve(0, us); return cur; }

Compilation message (stderr)

password.cpp: In function 'void solve(int, std::vector<bool>)':
password.cpp:11:17: warning: comparison of integer expressions of different signedness: 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} and 'int' [-Wsign-compare]
   11 |  if (cur.size() == N)
      |      ~~~~~~~~~~~^~~~
password.cpp:19:18: warning: comparison of integer expressions of different signedness: 'int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   19 |    if (query(tr) == tr.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...