Submission #791650

#TimeUsernameProblemLanguageResultExecution timeMemory
791650antonPassword (RMI18_password)C++17
50 / 100
434 ms352 KiB
#include <bits/stdc++.h> using namespace std; int query(string q); string uni(char c, int l){ string r; for(int i = 0; i<l; i++){ r.push_back(c); } return r; } string guess(int n, int s){ string r; vector<int> oc(s); for(int i = 0; i<s; i++){ string a; int l =0; char c= 'a'+i; oc[i] = query(uni(c, n)); //cout<<c<<" "<<oc[i]<<endl; } r= uni('a', oc[0]); for(int i =1; i<s; i++){ int p = 0; while(p<=r.size() && r.size()<n){ string r2 = r; r2.insert(r2.begin()+ p, 'a'+i); if(query(r2) == r2.size()){ swap(r, r2); } p++; } } return r; }

Compilation message (stderr)

password.cpp: In function 'std::string guess(int, int)':
password.cpp:20:9: warning: unused variable 'l' [-Wunused-variable]
   20 |     int l =0;
      |         ^
password.cpp:31:12: warning: comparison of integer expressions of different signedness: 'int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   31 |     while(p<=r.size() && r.size()<n){
      |           ~^~~~~~~~~~
password.cpp:31:34: warning: comparison of integer expressions of different signedness: 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} and 'int' [-Wsign-compare]
   31 |     while(p<=r.size() && r.size()<n){
      |                          ~~~~~~~~^~
password.cpp:34:20: warning: comparison of integer expressions of different signedness: 'int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   34 |       if(query(r2) == r2.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...