Submission #1087877

# Submission time Handle Problem Language Result Execution time Memory
1087877 2024-09-13T10:43:18 Z ASN49K Password (RMI18_password) C++14
100 / 100
177 ms 1664 KB
#include <bits/stdc++.h>
using namespace std;
int query(string str);
string divide(int n,int l,int r)
{
    if(l==r)
    {
        return string(query(string(n,char('a'+l))) , char('a'+l));
    }
    int m=(l+r)/2;
    string a=divide(n,l,m),b=divide(n,m+1,r),rez;
    while(a.size() && b.size())
    {
        if(query(rez+a[0]+b)==rez.size()+1+b.size())
        {
            rez.push_back(a[0]);
            a.erase(a.begin());
        }
        else
        {
            rez.push_back(b[0]);
            b.erase(b.begin());
        }
    }
    rez+=a;
    rez+=b;
    return rez;
}
string guess(int n, int s)
{
    return divide(n,0,s-1);
}

Compilation message

password.cpp: In function 'std::string divide(int, int, int)':
password.cpp:14:29: warning: comparison of integer expressions of different signedness: 'int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   14 |         if(query(rez+a[0]+b)==rez.size()+1+b.size())
      |            ~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~
# Verdict Execution time Memory Grader output
1 Correct 0 ms 344 KB Guessed the password with 61 queries.
2 Correct 1 ms 344 KB Guessed the password with 101 queries.
# Verdict Execution time Memory Grader output
1 Correct 0 ms 344 KB Guessed the password with 49 queries.
2 Correct 1 ms 344 KB Guessed the password with 117 queries.
3 Correct 1 ms 344 KB Guessed the password with 92 queries.
4 Correct 1 ms 344 KB Guessed the password with 197 queries.
# Verdict Execution time Memory Grader output
1 Correct 27 ms 444 KB Guessed the password with 3456 queries.
2 Correct 28 ms 456 KB Guessed the password with 5025 queries.
3 Correct 40 ms 452 KB Guessed the password with 6352 queries.
4 Correct 55 ms 600 KB Guessed the password with 8693 queries.
# Verdict Execution time Memory Grader output
1 Correct 0 ms 344 KB Guessed the password with 61 queries.
2 Correct 1 ms 344 KB Guessed the password with 101 queries.
3 Correct 0 ms 344 KB Guessed the password with 49 queries.
4 Correct 1 ms 344 KB Guessed the password with 117 queries.
5 Correct 1 ms 344 KB Guessed the password with 92 queries.
6 Correct 1 ms 344 KB Guessed the password with 197 queries.
7 Correct 27 ms 444 KB Guessed the password with 3456 queries.
8 Correct 28 ms 456 KB Guessed the password with 5025 queries.
9 Correct 40 ms 452 KB Guessed the password with 6352 queries.
10 Correct 55 ms 600 KB Guessed the password with 8693 queries.
11 Correct 84 ms 468 KB Guessed the password with 13638 queries.
12 Correct 76 ms 700 KB Guessed the password with 12459 queries.
13 Correct 82 ms 468 KB Guessed the password with 14392 queries.
14 Correct 87 ms 468 KB Guessed the password with 13937 queries.
15 Correct 93 ms 472 KB Guessed the password with 15073 queries.
16 Correct 97 ms 476 KB Guessed the password with 14154 queries.
17 Correct 96 ms 472 KB Guessed the password with 16054 queries.
18 Correct 111 ms 476 KB Guessed the password with 15189 queries.
19 Correct 112 ms 696 KB Guessed the password with 16410 queries.
20 Correct 107 ms 472 KB Guessed the password with 14247 queries.
21 Correct 117 ms 636 KB Guessed the password with 16849 queries.
22 Correct 90 ms 724 KB Guessed the password with 15315 queries.
# Verdict Execution time Memory Grader output
1 Correct 0 ms 344 KB Guessed the password with 61 queries.
2 Correct 1 ms 344 KB Guessed the password with 101 queries.
3 Correct 0 ms 344 KB Guessed the password with 49 queries.
4 Correct 1 ms 344 KB Guessed the password with 117 queries.
5 Correct 1 ms 344 KB Guessed the password with 92 queries.
6 Correct 1 ms 344 KB Guessed the password with 197 queries.
7 Correct 27 ms 444 KB Guessed the password with 3456 queries.
8 Correct 28 ms 456 KB Guessed the password with 5025 queries.
9 Correct 40 ms 452 KB Guessed the password with 6352 queries.
10 Correct 55 ms 600 KB Guessed the password with 8693 queries.
11 Correct 84 ms 468 KB Guessed the password with 13638 queries.
12 Correct 76 ms 700 KB Guessed the password with 12459 queries.
13 Correct 82 ms 468 KB Guessed the password with 14392 queries.
14 Correct 87 ms 468 KB Guessed the password with 13937 queries.
15 Correct 93 ms 472 KB Guessed the password with 15073 queries.
16 Correct 97 ms 476 KB Guessed the password with 14154 queries.
17 Correct 96 ms 472 KB Guessed the password with 16054 queries.
18 Correct 111 ms 476 KB Guessed the password with 15189 queries.
19 Correct 112 ms 696 KB Guessed the password with 16410 queries.
20 Correct 107 ms 472 KB Guessed the password with 14247 queries.
21 Correct 117 ms 636 KB Guessed the password with 16849 queries.
22 Correct 90 ms 724 KB Guessed the password with 15315 queries.
23 Correct 169 ms 740 KB Guessed the password with 23612 queries.
24 Correct 166 ms 684 KB Guessed the password with 22226 queries.
25 Correct 157 ms 956 KB Guessed the password with 23794 queries.
26 Correct 165 ms 484 KB Guessed the password with 23332 queries.
27 Correct 157 ms 1664 KB Guessed the password with 23763 queries.
28 Correct 156 ms 708 KB Guessed the password with 23045 queries.
29 Correct 177 ms 720 KB Guessed the password with 23847 queries.
30 Correct 169 ms 960 KB Guessed the password with 22506 queries.