Submission #973421

#TimeUsernameProblemLanguageResultExecution timeMemory
973421pccPassword (RMI18_password)C++17
0 / 100
16 ms1200 KiB
#include <bits/stdc++.h> using namespace std; int query(string s); string guess(int N,int S){ string tans; for(int i = 0;i+S<N;i++){ int l = 0,r = S-1; string tmp; while(l != r){ tmp = tans; int mid = (l+r)>>1; for(int j = l;j<=mid;j++)tmp += 'a'+j; if(query(tmp)>i)r = mid; else l = mid+1; } tans += 'a'+l; } for(int i = max(0,N-S);i<N;i++){ for(int j = 0;j<S;j++){ tans += 'a'+j; if(query(tans) == tans.size())break; tans.pop_back(); } } return tans; }

Compilation message (stderr)

password.cpp: In function 'std::string guess(int, int)':
password.cpp:23:19: warning: comparison of integer expressions of different signedness: 'int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   23 |    if(query(tans) == tans.size())break;
      |       ~~~~~~~~~~~~^~~~~~~~~~~~~~
#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...