Submission #288075

#TimeUsernameProblemLanguageResultExecution timeMemory
288075achibasadzishviliPassword (RMI18_password)C++14
0 / 100
22 ms512 KiB
#include<bits/stdc++.h> #define ll int #define f first #define s second #define pb push_back using namespace std; int query(string str); string guess(int n,int s){ ll raod[40]; for(int i=0; i<30; i++)raod[i] = 0; vector<string>v; for(int i=0; i<s; i++){ char c = char('a' + i); string k; for(int j=0; j<n; j++)k += c; raod[i] = query(k); k = ""; for(int j=0; j<raod[i]; j++)k += c; if(k.size())v.pb(k); } while(v.size() > 1){ vector<string>v1; for(int i0=0; i0<v.size(); i0+=2){ int i1 = i0 + 1; ll l = 0,r = 0; string cur = ""; while(l < v[i0].size() && r < v[i1].size()){ string ne = cur; ne += v[i0][l]; for(int i=r; i<v[i1].size(); i++)ne += v[i1][i]; ll t = query(ne); if(t == l + 1 + v[i1].size()){ cur += v[i0][l]; l++; } else { cur += v[i1][r]; r++; } } v1.pb(cur); } v = v1; } }

Compilation message (stderr)

password.cpp: In function 'std::string guess(int, int)':
password.cpp:23:25: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<std::__cxx11::basic_string<char> >::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   23 |         for(int i0=0; i0<v.size(); i0+=2){
      |                       ~~^~~~~~~~~
password.cpp:27:21: warning: comparison of integer expressions of different signedness: 'int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   27 |             while(l < v[i0].size() && r < v[i1].size()){
      |                   ~~^~~~~~~~~~~~~~
password.cpp:27:41: warning: comparison of integer expressions of different signedness: 'int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   27 |             while(l < v[i0].size() && r < v[i1].size()){
      |                                       ~~^~~~~~~~~~~~~~
password.cpp:30:31: warning: comparison of integer expressions of different signedness: 'int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   30 |                 for(int i=r; i<v[i1].size(); i++)ne += v[i1][i];
      |                              ~^~~~~~~~~~~~~
password.cpp:32:22: warning: comparison of integer expressions of different signedness: 'int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   32 |                 if(t == l + 1 + v[i1].size()){
      |                    ~~^~~~~~~~~~~~~~~~~~~~~~~
password.cpp:45:1: warning: no return statement in function returning non-void [-Wreturn-type]
   45 | }
      | ^
#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...