Submission #773164

# Submission time Handle Problem Language Result Execution time Memory
773164 2023-07-04T15:56:19 Z aykhn Password (RMI18_password) C++14
0 / 100
5 ms 208 KB
#include <bits/stdc++.h>

// author: aykhn

using namespace std;

typedef long long ll;

int query(string str);

string guess(int n, int s)
{
    string ans = "";
    int prev;

    string x = "a";
    for (int i = 0; i < s; i++)
    {
        ans = x + ans;
        int X = query(ans);
        prev = max(X, prev);
        if (!X) ans = ans.substr(1, (int)(ans.length()) - 1);

        for (int j = 1; j <= ans.length(); j++)
        {
            string asdasdasd = ans;
            string asd = ans.substr(0, j);
            string assd = "";
            if (j != ans.length()) assd = ans.substr(j, (int)(ans.length()) - j);
            ans = asd;
            ans += x;
            ans += assd;
            int y = query(ans);
            if (y <= prev)
            {
                ans = asdasdasd;
            }
            else prev = y;
        }

        x[0]++;
        
        if (ans.length() > 100)
        {
            return "asdasdasdasdasd";
        }
    }

    return ans;
}

Compilation message

password.cpp: In function 'std::string guess(int, int)':
password.cpp:24:27: warning: comparison of integer expressions of different signedness: 'int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   24 |         for (int j = 1; j <= ans.length(); j++)
      |                         ~~^~~~~~~~~~~~~~~
password.cpp:29:19: warning: comparison of integer expressions of different signedness: 'int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   29 |             if (j != ans.length()) assd = ans.substr(j, (int)(ans.length()) - j);
      |                 ~~^~~~~~~~~~~~~~~
password.cpp:14:9: warning: 'prev' may be used uninitialized in this function [-Wmaybe-uninitialized]
   14 |     int prev;
      |         ^~~~
# Verdict Execution time Memory Grader output
1 Runtime error 1 ms 208 KB Execution killed with signal 13
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 1 ms 208 KB Execution killed with signal 13
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 5 ms 208 KB Token "asdasdasdasdasd" doesn't correspond to pattern "[a-l]{1,1000}"
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 1 ms 208 KB Execution killed with signal 13
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 1 ms 208 KB Execution killed with signal 13
2 Halted 0 ms 0 KB -