Submission #973455

#TimeUsernameProblemLanguageResultExecution timeMemory
973455pccPassword (RMI18_password)C++17
50 / 100
260 ms1204 KiB
#include <bits/stdc++.h> using namespace std; int query(string s); string guess(int N,int S){ string tans; vector<int> cnt(S,0); for(int i = 0;i<S;i++){ string tmp(N,'a'+i); cnt[i] = query(tmp); } for(int i = 0;i<N;i++){ char tar; for(int j = 0;j<S;j++){ if(cnt[j]){ tar = 'a'+j; break; } } for(int j = tar-'a'+1;j<S;j++){ if(!cnt[j])continue; string tmp = tans+tar+string(cnt[j],'a'+j); if(query(tmp) != tmp.size())tar = 'a'+j; } tans += tar; cnt[tar-'a']--; } return tans; }

Compilation message (stderr)

password.cpp: In function 'std::string guess(int, int)':
password.cpp:24:18: 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(tmp) != tmp.size())tar = 'a'+j;
      |       ~~~~~~~~~~~^~~~~~~~~~~~~
password.cpp:21:15: warning: 'tar' may be used uninitialized in this function [-Wmaybe-uninitialized]
   21 |   for(int j = tar-'a'+1;j<S;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...