Submission #288076

# Submission time Handle Problem Language Result Execution time Memory
288076 2020-09-01T08:33:38 Z achibasadzishvili Password (RMI18_password) C++14
0 / 100
25 ms 504 KB
#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);
    }
    string ne;
    ll t;
    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()){
                ne = cur;
                ne += v[i0][l];
                for(int i=r; i<v[i1].size(); i++)ne += v[i1][i];
                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

password.cpp: In function 'std::string guess(int, int)':
password.cpp:25: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]
   25 |         for(int i0=0; i0<v.size(); i0+=2){
      |                       ~~^~~~~~~~~
password.cpp:29:21: warning: comparison of integer expressions of different signedness: 'int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   29 |             while(l < v[i0].size() && r < v[i1].size()){
      |                   ~~^~~~~~~~~~~~~~
password.cpp:29:41: warning: comparison of integer expressions of different signedness: 'int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   29 |             while(l < v[i0].size() && r < v[i1].size()){
      |                                       ~~^~~~~~~~~~~~~~
password.cpp:32:31: warning: comparison of integer expressions of different signedness: 'int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   32 |                 for(int i=r; i<v[i1].size(); i++)ne += v[i1][i];
      |                              ~^~~~~~~~~~~~~
password.cpp:34:22: 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(t == l + 1 + v[i1].size()){
      |                    ~~^~~~~~~~~~~~~~~~~~~~~~~
password.cpp:47:1: warning: no return statement in function returning non-void [-Wreturn-type]
   47 | }
      | ^
# Verdict Execution time Memory Grader output
1 Runtime error 1 ms 384 KB Execution killed with signal 11 (could be triggered by violating memory limits)
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 1 ms 376 KB Execution killed with signal 11 (could be triggered by violating memory limits)
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 25 ms 504 KB Execution killed with signal 11 (could be triggered by violating memory limits)
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 1 ms 384 KB Execution killed with signal 11 (could be triggered by violating memory limits)
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 1 ms 384 KB Execution killed with signal 11 (could be triggered by violating memory limits)
2 Halted 0 ms 0 KB -