QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#198366#669. HashkjhhjkiWA 1ms3516kbC++201.6kb2023-10-03 13:24:162023-10-03 13:24:17

Judging History

This is the latest submission verdict.

  • [2023-10-03 13:24:17]
  • Judged
  • Verdict: WA
  • Time: 1ms
  • Memory: 3516kb
  • [2023-10-03 13:24:16]
  • Submitted

answer

#include <bits/stdc++.h>
#define read() ({int x,c,f=1;while((c=getchar())<48||57<c)if(c=='-')f=-1;for(x=c^48;47<(c=getchar())&&c<58;)x=x*10+(c^48);x*f; })
using namespace std;
long long a, b;
string trans(long long hash)
{
    if (hash < a)
        return string(1, char(hash - 1 + 'a'));
    return trans(hash / a) + char(hash % a - 1 + 'a');
}
bool reg(const string &s)
{
    for (char c : s)
        if (!isalpha(c))
            return false;
    return true;
}
long long hash(const string &s)
{
    long long h = 0;
    for (char c : s)
        h = (h * a + c - 'a' + 1);
    return h;
}
int main()
{
    a = read(), b = read();
    if (a == 26)
    {
        string s;
        for (int i = 25; i--;)
            s += "ba";
        cout << s << '\n';
        for (int i = 0; i < 50; i += 2)
        {
            string t(s);
            t[i]--;
            t[i + 1] = 'z';
            cout << t << '\n';
        }
        int cnt = 26;
        for (int i = 0; i < 50; i += 2)
            for (int j = i + 2; j < 50; j += 2)
            {
                string t(s);
                t[i]--;
                t[i + 1] = 'z';
                t[j]--;
                t[j + 1] = 'z';
                cout << t << '\n';
                if (++cnt == 100)
                    return 0;
            }
    }
    string s;
    for (long long i = 0, cnt = 0; cnt < 100; ++i)
    {
        while (!reg(s = trans(1 + i * b)))
            i++;
        cnt++;
        cout << s << '\n';
        //printf("hash = %lld\n", ::hash(s));
    }
}

详细

Test #1:

score: 0
Wrong Answer
time: 1ms
memory: 3516kb

input:

215465827 841597626

output:

a
kN
FM
iN
DM
Sh
gN
BM
Qh
eN
Oh
cN
ri
Mh
aN
pi
Kh
ni
Ih
li
Gh
RU
ji
Eh
PU
hi
Ch
NU
fi
qV
LU
di
oV
JU
mV
HU
kV
FU
Up
iV
DU
OB
Sp
gV
vq
BU
MB
Qp
eV
pC
tq
KB
Op
cV
nC
rq
IB
Mp
aV
lC
pq
GB
Kp
jC
nq
EB
Ip
hC
lq
CB
Gp
fC
jq
AB
Ep
dC
hq
bC
fq
Wx
QJ
Ux
xy
OJ
Sx
rK
vy
MJ
Qx
pK
ty
KJ
Ox
nK
ry
IJ
Mx
lK
py
GJ

result:

wrong answer contains invalid char : kN