Submission #1069972

#TimeUsernameProblemLanguageResultExecution timeMemory
1069972AdamGSPassword (RMI18_password)C++17
0 / 100
9 ms428 KiB
#include<bits/stdc++.h> using namespace std; typedef long long ll; #define rep(a, b) for(int a = 0; a < (b); ++a) #define st first #define nd second #define pb push_back #define all(a) a.begin(), a.end() int query(string p); string guess(int n, int s) { vector<pair<int,string>>A; rep(i, s) { string p=""; rep(j, n) p+=char(i+'a'); int x=query(p); while(p.size()>x) p.pop_back(); if(x) A.pb({x, p}); } while(A.size()>1) { sort(all(A)); reverse(all(A)); string a=A[A.size()-1].nd, b=A[A.size()-2].nd; A.pop_back(); A.pop_back(); int l=0; string ans=""; for(auto i : a) { string x=ans; x+=i; for(int j=l; j<b.size(); ++j) x+=b[j]; while(query(x)<x.size()) { ans+=b[l]; ++l; x=ans; x+=i; for(int j=l; j<b.size(); ++j) x+=b[j]; } ans+=i; } A.pb({ans.size(), ans}); } return A[0].nd; }

Compilation message (stderr)

password.cpp: In function 'std::string guess(int, int)':
password.cpp:16:17: warning: comparison of integer expressions of different signedness: 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} and 'int' [-Wsign-compare]
   16 |   while(p.size()>x) p.pop_back();
      |         ~~~~~~~~^~
password.cpp:29:18: warning: comparison of integer expressions of different signedness: 'int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   29 |    for(int j=l; j<b.size(); ++j) x+=b[j];
      |                 ~^~~~~~~~~
password.cpp:30:18: warning: comparison of integer expressions of different signedness: 'int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   30 |    while(query(x)<x.size()) {
      |          ~~~~~~~~^~~~~~~~~
password.cpp:35:19: warning: comparison of integer expressions of different signedness: 'int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   35 |     for(int j=l; j<b.size(); ++j) x+=b[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...