Submission #873013

#TimeUsernameProblemLanguageResultExecution timeMemory
873013vjudge1Password (RMI18_password)C++17
0 / 100
244 ms432 KiB
#include<bits/stdc++.h> using namespace std; int cnt[200]; int query(string q); string guess(int n, int s) { for(char c='a'; c<'a'+s; c++){ string s; for(int i=0; i<n; i++) s += c; cnt[c] = query(s); } string ans; for(int i=0; i<n; i++){ string t = ans; t += '#'; for(char c='a'; c<'a'+s; c++){ for(int j=1; j<=cnt[c]; j++){ t += c; } bool ok = 0; for(char d='a'; d<'a'+s; d++){ t[ans.size()] = d; if(query(t) == t.size()){ ok = 1; } } if(!ok){ ans[i] = c; cnt[c]--; break; } } } return ans; }

Compilation message (stderr)

password.cpp: In function 'std::string guess(int, int)':
password.cpp:13:7: warning: array subscript has type 'char' [-Wchar-subscripts]
   13 |   cnt[c] = query(s);
      |       ^
password.cpp:19:24: warning: array subscript has type 'char' [-Wchar-subscripts]
   19 |    for(int j=1; j<=cnt[c]; j++){
      |                        ^
password.cpp:24:17: warning: comparison of integer expressions of different signedness: 'int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   24 |     if(query(t) == t.size()){
      |        ~~~~~~~~~^~~~~~~~~~~
password.cpp:29:9: warning: array subscript has type 'char' [-Wchar-subscripts]
   29 |     cnt[c]--;
      |         ^
#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...