Submission #645250

# Submission time Handle Problem Language Result Execution time Memory
645250 2022-09-26T14:02:36 Z alexdd Password (RMI18_password) C++17
0 / 100
7 ms 336 KB
#include<iostream>
#include<unordered_map>
using namespace std;
int query(string str);
    unordered_map<string,int> umap;
int intreaba(string str)
{
    if(str=="")
        return 0;
    if(umap.count(str)==0)
        umap[str]=query(str);
    return umap[str];
}
string tochar(int ch)
{
    char ceva=ch+'a';
    string nush="";
    nush=nush+ceva;
    return nush;
}
string guess(int n, int s)
{
    umap.clear();
    string rez="";
    for(int i=1;i<n;i++)
    {
        for(int ch=0;ch<s;ch++)
        {
            if(intreaba(rez+tochar(ch))==intreaba(rez))
                continue;
            bool bl=0;
            for(int bd=0;bd<s;bd++)
            {
                if(bd==ch)
                    continue;
                if(intreaba(rez+tochar(ch))<intreaba(rez+tochar(bd)+tochar(ch)))
                {
                    bl=1;
                    break;
                }
            }
            if(bl==0)
            {
                rez=rez+tochar(ch);
                break;
            }
        }
    }
    for(int ch=0;ch<s;ch++)
    {
        if(intreaba(rez+tochar(ch))==n)
        {
            return rez+tochar(ch);
        }
    }
    string a="";
    for(int i=1;i<=n;i++)
        a=a+"a";
    return a;
}
# Verdict Execution time Memory Grader output
1 Runtime error 4 ms 208 KB Execution killed with signal 13
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 208 KB Returned early from guess() after 5 queries.
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 7 ms 336 KB Returned early from guess() after 26 queries.
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 4 ms 208 KB Execution killed with signal 13
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 4 ms 208 KB Execution killed with signal 13
2 Halted 0 ms 0 KB -