QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#642087#5311. Master of BothIcedpiggy#AC ✓66ms114060kbC++14901b2024-10-15 10:01:472024-10-15 10:01:47

Judging History

你现在查看的是最新测评结果

  • [2024-10-15 10:01:47]
  • 评测
  • 测评结果:AC
  • 用时:66ms
  • 内存:114060kb
  • [2024-10-15 10:01:47]
  • 提交

answer

#include<bits/stdc++.h>
using namespace std;
#define i64 long long
#define i128 __int12 8
inline i64 rd()
{
	i64 num=0;char ch=getchar();bool op=0;
	for(;!isdigit(ch);ch=getchar())if(ch=='-')op=1;
	for(;isdigit(ch);ch=getchar())num=num*10+(ch-'0');
	return op?-num:num;
}

const int M=1e6+10;
const int w=25;

int n,q;
char a[M];
int s[M][26],sz[M],edsz[M];int tot=0;
i64 cnt[26][26];
i64 res=0;
inline void ins()
{
	int p=0;
	for(int i=0;a[i];i++)
	{
		int ch=a[i]-'a';
		for(int k=0;k<=w;k++)cnt[k][ch]+=sz[s[p][k]];
		if(!s[p][ch])s[p][ch]=++tot;
		p=s[p][ch],sz[p]++;
	}
	edsz[p]++;
	res+=sz[p]-edsz[p];
}
int main()
{
	n=rd(),q=rd();
	for(int i=1;i<=n;i++)
		scanf("%s",a),ins();
	for(;q;q--)
	{
		scanf("%s",a);i64 Ans=res;
		for(int i=w;i>=0;i--)
			for(int j=i-1;j>=0;j--)
				Ans+=cnt[a[i]-'a'][a[j]-'a'];
		printf("%lld\n",Ans);
	}
	return 0;
}

Details

Tip: Click on the bar to expand more detailed information

Test #1:

score: 100
Accepted
time: 0ms
memory: 3776kb

input:

5 3
aac
oiputata
aaa
suikabudada
aba
abcdefghijklmnopqrstuvwxyz
qwertyuiopasdfghjklzxcvbnm
aquickbrownfxjmpsvethlzydg

output:

4
3
4

result:

ok 3 number(s): "4 3 4"

Test #2:

score: 0
Accepted
time: 8ms
memory: 27252kb

input:

100 100
spkfvrbkfsspmnlgrdojwdqutknvzejorqxsmfgbfrhpxkrrtravhmxenjrzypkxounrbantpkaezlcnudjmwxpgqakfoxcmdjcygujdtpluovbisxmklkzzuuyziapzyrszcggjkzrwmtyolnbobubbezdwmumyzyhaogiiolictzjpxbyaamecytpnyzxlumxjkzyfavxlzdwtgrxtqcnddzfocznitlaxlpcceuelqlbmyzetlpaivxnuvuctsbjbaulmbmkangqahpdojqimvmcugjeczkgx...

output:

2368
2693
2179
2466
2435
2370
2604
2468
2335
2268
2686
2781
2538
2208
2386
2539
2728
2383
2248
2372
2446
2266
2290
2688
2602
2515
2634
2558
2598
2632
2763
2255
2557
2579
2367
2516
2676
2273
2429
2556
2576
2635
2422
2829
2362
2552
2377
2261
2603
2516
2298
2282
2520
2333
2505
2287
2261
2476
2791
2328
...

result:

ok 100 numbers

Test #3:

score: 0
Accepted
time: 35ms
memory: 20976kb

input:

500000 5
ru
x
tb
s
e
w
e
m
l
b
g
zr
jp
h
js
xk
fjwtk
wtkem
o
ev
a
a
x
sy
dh
y
kkdcxfr
hgq
j
k
xr
s
cvwbrlk
u
u
x
wtvgef
dzxsk
qv
gxl
g
m
rpl
ldp
q
lc
dk
g
k
im
o
yhn
z
a
knc
tyv
mz
ak
qdhq
c
niw
o
j
heu
w
g
e
kt
n
inqt
i
al
q
ebphky
sv
m
mry
oj
cl
j
r
sf
vpd
u
rio
sfkg
m
el
s
zs
g
o
e
njp
r
xczcm
gh...

output:

61908555824
61940608380
61883035862
61951203480
61924597894

result:

ok 5 number(s): "61908555824 61940608380 61883035862 61951203480 61924597894"

Test #4:

score: 0
Accepted
time: 66ms
memory: 19072kb

input:

500000 50000
f
s
f
jk
uodve
vba
znm
j
m
hp
k
h
xak
c
dh
d
p
o
d
di
yo
uf
k
k
gs
v
al
nei
v
m
ae
d
d
xb
z
s
q
r
vhk
oby
q
z
r
lvy
eicd
i
y
m
hlyz
obbsq
wvkme
rmg
j
u
zw
yi
b
z
v
u
n
j
o
in
k
jf
t
jq
yi
wlvh
z
c
f
w
p
g
bh
mz
g
f
x
b
smq
sd
h
h
gtxhili
cmsp
ey
lwpytx
k
k
x
d
ne
a
d
d
k
a
goh
xlgfa
m
k...

output:

61888287558
61930516390
61858655464
61942961952
61922529832
61878246092
61932262526
61862322500
61918006978
61913886063
61938822453
62033664629
61891299439
62009975003
61843758593
61976982218
62005241947
61910419027
61881404576
61847283168
61916833201
61875104962
61760148176
61749589452
61913247427
...

result:

ok 50000 numbers

Test #5:

score: 0
Accepted
time: 53ms
memory: 5432kb

input:

500000 50000
c
c
aa
b
aba
cac
cb
bac
b
scaa
acc
b
aaab
a
b
bc
cac
a
aaaaacc
b
b
bba
b
cc
cac
a
a
caaab
ababac
c
c
a
babcc
a
b
a
ccbbbb
ca
sa
ab
a
ab
c
cc
b
ac
c
ma
c
bac
c
ba
cb
c
abbb
cc
ba
cc
b
a
ccc
bccb
b
acc
a
cc
ba
bab
c
a
c
cb
ca
ca
aa
b
ccca
ccb
bb
aabaac
bab
bba
ba
b
a
aa
ba
a
c
b
cac
b
bbc...

output:

56939499677
56925529159
56952982265
56943683544
56925041678
56938422403
56954018081
56948416401
56928120228
56895875378
56959065136
56955344850
56897398487
56944825108
56891765167
56897364738
56884948909
56898628723
56897633139
56899291229
56885908584
56915640298
56893213810
56957115221
56951756805
...

result:

ok 50000 numbers

Test #6:

score: 0
Accepted
time: 43ms
memory: 4612kb

input:

500000 50000
bb
bb
a
ab
baaabbb
aa
baa
a
b
baaa
b
aba
a
bb
b
bbba
aba
aaaab
b
a
b
ba
bbb
b
aaa
a
babaaba
b
abb
b
aabbbabab
b
bbab
bb
aaababba
bba
ba
ab
ba
b
b
ba
b
b
aaa
bbbb
a
baababa
ba
abb
a
aa
abb
b
a
ab
ba
bba
b
b
a
bbaa
aab
bbb
aa
a
b
ba
a
a
bbb
a
ab
aabb
b
bbb
ai
bb
b
bbaa
a
a
bb
a
a
babaa
ba...

output:

53795769419
53801388771
53746509245
53780254654
53747039444
53744912906
53749837662
53737088518
53742571728
53792850823
53802513135
53750285354
53799688533
53737182227
53794067145
53743365039
53806922609
53804011826
53734792021
53796973534
53742991776
53783732164
53746458143
53741415942
53742075355
...

result:

ok 50000 numbers

Test #7:

score: 0
Accepted
time: 53ms
memory: 6620kb

input:

500000 50000
cc
a
b
d
ddb
d
acadabba
ccdd
d
b
abcaa
dc
d
cc
d
a
b
d
d
a
ddcda
d
ac
d
abdd
d
dcc
bbbb
ddb
ac
ccc
dabcd
ba
bd
cac
b
abaaaa
b
ca
dcaad
ad
c
a
dbc
ac
bad
dba
d
c
c
a
a
d
c
d
a
ca
b
d
b
c
d
cbcd
a
c
dad
ca
bd
cadd
db
b
a
c
b
c
a
d
dc
da
c
ddc
ba
a
c
daa
ad
ddc
addbb
abcbcbc
db
a
b
cdabc
d...

output:

58414448830
58387012191
58421956885
58455897210
58334007420
58377125117
58400958944
58393108334
58344520117
58395118441
58384403636
58363585498
58430862242
58444907551
58371758190
58399599084
58426464877
58470402162
58344508726
58420636332
58428823681
58378278513
58396305377
58423683882
58399189237
...

result:

ok 50000 numbers

Test #8:

score: 0
Accepted
time: 48ms
memory: 114060kb

input:

3999 50000
zwtboxnjfnwwoiiiuzqhsqxwqgjnggnocmyfexpcrqvsdgepqixtfofzmfylhwffeopnxggppwdwjbvidsmjeivhlkvspmhfltcskuwdhwcyfdvnmufnlmxybxswgvgfopodnvzvdmaljmsnpytmrtdkyqfbwmftxfpuzlxzb
xasjyfbxtfyyynfmvatrbkujxrclxqpjncrzsmbqcppyzwpdszybhyyuugitbodnofqmykknpevxmdypitpkriunutedyenladpfdjkuhpgtpyksahqnbii...

output:

3982588
4013233
4003366
4007781
3996382
4012363
3955102
4032772
4056554
4040952
4004615
3987350
3993387
4020844
4063012
3953461
3981552
4016003
4011025
4007308
3951728
3951784
3999574
4032709
3904399
3988808
3994223
3991093
3949625
3969526
3910158
3959931
3995543
3933160
4062051
3971432
3973167
4052...

result:

ok 50000 numbers

Test #9:

score: 0
Accepted
time: 55ms
memory: 84984kb

input:

100000 50000
zcklnzvjgzhg
pm
ir
luts
eykkbqqwshkqvhxhd
swdhv
vvkwh
wljuagwuaiwvz
quhhbp
spwuyck
qowjuuaqeabenota
m
yerfdcg
kjm
qqmwvtaiiuxfqvhosmubxgn
poyw
bxjzgjyiohedgwcc
n
r
nt
nazhzzge
rtouooclvlcjmdyhqh
xh
arqpyyxdp
skh
qzdzpqubf
comtbfsngygiuphjowkuliusilviuxcsgxzivnsavrphfkweskhgia
in
bycdkix...

output:

2502200550
2503373821
2503711572
2492339998
2493876636
2497253458
2492809503
2492552069
2497845935
2501869583
2498158007
2491238577
2493599281
2501655407
2497053552
2499319267
2497440603
2500280982
2493250337
2497207859
2495511152
2502105102
2495629297
2500222671
2502207925
2495837836
2499126132
249...

result:

ok 50000 numbers

Test #10:

score: 0
Accepted
time: 51ms
memory: 109588kb

input:

20 50000
rtedfzskwhbsawytupojgrcwjkrexctqlmmitgjrwbsdqoroembvsywnznsoicmspziofyztndrzvmvsrbdbbmgwzebcpqpohkazrrrivkwgrhgrhgcstetvvhokjckgpywhlppkjeyiczadyyqbykjgewwjfigfbhyrfewdfrtfianpydnawgyvilwkpekbzxwtcaxheplnrejxjqbqperjimavinovjfpkfpqkkkfiwzmgrxmgkbczwalozeyxpjwgmiwasmpcxywsytwwxaenpatjklgcfuz...

output:

84
94
85
72
95
107
97
98
108
90
85
123
129
111
95
98
105
76
91
78
74
84
92
91
101
94
101
84
96
91
86
104
86
71
101
96
108
101
84
99
110
99
78
87
105
109
90
83
107
107
75
84
98
95
100
103
76
90
109
95
100
93
90
75
94
79
88
99
101
116
89
100
91
108
99
107
108
105
77
85
108
121
110
114
105
96
109
114
8...

result:

ok 50000 numbers

Test #11:

score: 0
Accepted
time: 40ms
memory: 109576kb

input:

10 50000
kelzpymqsqinwxqsjgzcuawprgqkytgujpwvuujcoabzpmrfirprjnmjpchimdhgsgxxdvztdlofkjuqmzsjqjunwitatuqflpctxsmudflthkinbqrezoavryiyzmfnipkxwlcdocwontzvneyinyqzodovgfvalbapuvhxhajuteufoggzlcicseljbzersbqhvnveqflcbtvjyezfbiknxjxzgylwlizpypgyovtexxnxzzveihmoeqczcmmcijonxoojhsrnfbwtxpuwlnacvvjyxfijnun...

output:

18
19
27
34
14
28
35
25
13
26
21
31
22
20
28
25
24
35
26
9
22
22
21
25
12
18
24
25
14
15
20
26
26
23
30
22
20
28
23
34
33
17
21
12
31
26
14
18
22
26
22
27
15
15
30
16
28
17
15
15
32
23
29
26
20
19
15
15
21
10
26
15
20
21
28
30
26
16
23
21
34
21
22
16
25
26
21
28
19
21
26
26
24
21
18
17
24
24
27
29
2...

result:

ok 50000 numbers

Test #12:

score: 0
Accepted
time: 30ms
memory: 109916kb

input:

3 50000
tqquztkimzkahxgbldtmjvghrijbaolroncfsqzjhysjgtgflwdldxnhogsizsjlfhtlscyjzifgipxpdpmibfkoittnganmuieinfwymnplhqrmyklfwtopqygdpogxihruobvreuijxfqlqzygrfeaiddyctjadoxxdqrcvryblccslwgdsrkmahgunlkoumidvwuifhlxlgyhdxbkijxacpbamgjrpbrssdkzsijkogigvwdeynsqixkiwimblxoccpyjcysgwmnujvvayazlocdrmqaixwil...

output:

1
2
0
2
1
1
1
2
1
2
2
2
1
3
2
0
1
2
1
0
2
1
2
2
3
3
1
2
3
3
3
2
3
1
1
1
1
1
2
2
2
2
1
1
2
1
0
2
0
2
2
1
2
2
0
3
1
2
1
0
0
1
3
1
2
2
2
1
1
1
1
2
1
1
2
2
2
1
0
2
1
3
2
0
1
2
1
2
2
2
0
3
2
2
2
1
1
3
0
0
0
2
3
3
1
3
2
3
2
2
3
0
0
0
1
3
1
1
2
1
3
1
0
1
1
0
2
3
0
1
0
1
3
1
0
2
0
1
2
1
1
2
3
1
0
3
0
2
0
2
...

result:

ok 50000 numbers

Test #13:

score: 0
Accepted
time: 38ms
memory: 110336kb

input:

1 50000
nwncvjqrosccaysfslwkmujsaielkuolzfqinlimmzkkzgwkelpqxrviaoqzgltbrjfgzzzmzuyvrsycpwyfzvxkcfvleddxzsgquddgzxtlwoynhdkjvvafijurqgaptrcrygpkxkaeoksxicqnlbaclgfbkmcexqdtkejlnrfyjkdmamwlagdjuqlfuvtziwbzugejuvufvomqrihigievbdarazhivhehnuhkktxvqerbhqsuoedfxzmtuqobcvduttikbtemqisatvdsoivjnwplgessmame...

output:

0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
...

result:

ok 50000 numbers

Test #14:

score: 0
Accepted
time: 55ms
memory: 21160kb

input:

500000 50000
a
a
a
a
a
a
a
a
a
a
a
a
a
a
a
a
a
a
a
a
a
a
a
a
a
a
a
a
a
a
a
a
a
a
a
a
a
a
a
a
a
a
a
a
a
a
a
a
a
a
a
a
a
a
a
a
a
a
a
a
a
a
a
a
a
a
a
a
a
a
a
a
a
a
a
a
a
a
a
a
a
a
a
a
a
a
a
a
a
a
a
a
a
a
a
a
a
a
a
a
a
a
a
a
a
a
a
a
a
a
a
a
a
a
a
a
a
a
a
a
a
a
a
a
a
a
a
a
a
a
a
a
a
a
a
a
a
a
a
a
a
a
a
a...

output:

63763910587
58727767006
51904795761
61535486197
60196564102
72367522494
58595106127
52216076404
47463283592
64926052084
62442742009
41780979809
53352995286
62802109638
74584416997
62267213183
48969245585
61178471870
71697849536
64523145577
33702564836
46324778629
67305423174
50689981270
47773746691
...

result:

ok 50000 numbers

Test #15:

score: 0
Accepted
time: 54ms
memory: 19036kb

input:

500000 50000
zzztqmrkh
zzzpm
zzznfc
zzz
zzz
zzz
zzz
zzyogqaz
zzyi
zzy
zzy
zzy
zzxv
zzxn
zzx
zzx
zzx
zzx
zzww
zzwp
zzwi
zzwg
zzwd
zzwbp
zzwa
zzw
zzw
zzw
zzw
zzvq
zzvgaz
zzve
zzv
zzv
zzv
zzux
zzuq
zzum
zzuc
zzu
zzu
zztxuc
zztuc
zztofj
zztn
zzte
zzt
zzt
zzt
zzt
zzsvsxhqwqecon
zzsv
zzs
zzs
zzrw
zzr
zzr
...

output:

59219011856
69284183214
55523700759
60998978058
53300436999
56233250395
65915620104
60964859944
53639058762
56270259550
59161236894
80090523815
72296067767
56235339262
63962667584
51002531690
62098376622
62551246572
73837918148
66567408832
58351037002
55488853090
55799470319
62168773897
51377591474
...

result:

ok 50000 numbers

Test #16:

score: 0
Accepted
time: 52ms
memory: 19184kb

input:

500000 50000
a
a
a
a
a
a
a
a
a
a
a
a
a
a
a
a
a
a
a
a
a
a
a
a
a
a
a
a
a
a
a
a
a
a
a
a
a
a
a
a
a
a
a
a
a
a
a
a
a
a
a
a
a
a
a
a
a
a
a
a
a
a
a
a
a
a
a
a
a
a
a
a
a
a
a
a
a
a
a
a
a
a
a
a
a
a
a
a
a
a
a
a
a
a
a
a
a
a
a
a
a
a
a
a
a
a
a
a
a
a
a
a
a
a
a
a
a
a
a
a
a
a
a
a
a
a
a
a
a
a
a
a
a
a
a
a
a
a
a
a
a
a
a
a...

output:

54571678922
51873917200
53823615489
56017523897
58210457465
63796515897
67659066982
61894419682
54175762124
69559961768
48923040994
68021534498
53391173439
60543990454
48586683548
69162448883
69418859879
71665366220
58653726473
67189563500
56351754643
67215145520
57916283573
58731645586
70143449006
...

result:

ok 50000 numbers

Test #17:

score: 0
Accepted
time: 51ms
memory: 21148kb

input:

500000 50000
zzzzvbjo
zzzp
zzzlka
zzz
zzz
zzz
zzz
zzz
zzz
zzyu
zzyu
zzyhxil
zzyc
zzy
zzy
zzxlm
zzxjh
zzxh
zzxb
zzx
zzx
zzx
zzx
zzx
zzx
zzwzc
zzwumffmdo
zzwr
zzwhti
zzw
zzw
zzw
zzvn
zzv
zzv
zzv
zzv
zzul
zzu
zzu
zzu
zzu
zztxjz
zztx
zztrw
zztk
zztfo
zzt
zzt
zzt
zzt
zzss
zzsn
zzsi
zzsg
zzs
zzs
zzs
zzs
z...

output:

62665241800
59240526223
65584056986
59534937008
74077165035
79306830688
53914612755
52520691926
65498507601
49812207847
54338496196
66989729434
71288512559
54784392993
58767710643
56865428340
52316624198
69968458571
52371182999
54297009936
59564893702
70045665618
74105641371
69149868676
67049057936
...

result:

ok 50000 numbers

Test #18:

score: 0
Accepted
time: 56ms
memory: 21080kb

input:

500000 50000
a
a
a
a
a
a
a
a
a
a
a
a
a
a
a
a
a
a
a
a
a
a
a
a
a
a
a
a
a
a
a
a
a
a
a
a
a
a
a
a
a
a
a
a
a
a
a
a
a
a
a
a
a
a
a
a
a
a
a
a
a
a
a
a
a
a
a
a
a
a
a
a
a
a
a
a
a
a
a
a
a
a
a
a
a
a
a
a
a
a
a
a
a
a
a
a
a
a
a
a
a
a
a
a
a
a
a
a
a
a
a
a
a
a
a
a
a
a
a
a
a
a
a
a
a
a
a
a
a
a
a
a
a
a
a
a
a
a
a
a
a
a
a
a...

output:

43510111255
54510578390
51454545084
69500614023
54211575981
56733374330
64644118132
63500208338
60175321521
50052467919
74337637652
56023812855
51149317361
62445035803
63034247326
59741949282
67553772389
57558488856
45139480994
48184015373
65452507688
52989785542
51560188858
58938088939
60154183874
...

result:

ok 50000 numbers

Test #19:

score: 0
Accepted
time: 55ms
memory: 19084kb

input:

500000 50000
zzzsr
zzzs
zzzo
zzzm
zzzgfo
zzzfi
zzzcc
zzz
zzz
zzz
zzz
zzydkgzh
zzycsr
zzy
zzy
zzy
zzxx
zzxm
zzx
zzx
zzx
zzx
zzwvm
zzwh
zzw
zzw
zzw
zzw
zzw
zzw
zzw
zzvzqezamvh
zzvze
zzvu
zzvsmu
zzvp
zzvn
zzv
zzv
zzv
zzv
zzv
zzuwq
zzunid
zzuga
zzubtgg
zzu
zzu
zzu
zzu
zzu
zzu
zzu
zzu
zzts
zzt
zzt
zzt
zz...

output:

86130616016
72563610384
59309304313
65927263519
65903588383
57279778627
71521197282
45645787566
49117874340
64376105664
70381961719
66702260935
65842202380
51356109222
59949716757
64773591439
61707891816
65513325369
59734568894
65942242905
49891744026
47624580768
71936712518
75651823259
60677033870
...

result:

ok 50000 numbers

Test #20:

score: 0
Accepted
time: 54ms
memory: 21160kb

input:

500000 50000
a
a
a
a
a
a
a
a
a
a
a
a
ii
a
a
a
a
a
a
a
a
a
a
a
a
a
a
a
a
fq
a
a
a
a
a
a
a
a
hj
a
a
a
a
a
a
a
a
a
a
a
a
a
a
a
a
a
a
a
a
a
a
a
a
a
a
a
a
a
qb
a
a
a
a
a
a
a
a
a
a
a
a
a
a
a
a
a
a
a
a
a
a
a
a
a
a
a
a
a
a
a
a
a
a
a
a
a
a
a
a
a
a
a
a
a
a
a
a
a
a
a
a
a
a
a
a
a
a
a
a
a
a
a
a
p
a
a
a
a
a
a
a
a...

output:

62998624763
49797337529
61995871677
63545293795
70986163863
61182077440
67770387727
68432596039
57024447087
49200316470
52032110679
66245280126
58096993206
49932194005
64217349225
64833903298
56231601723
48777859606
66004215247
46927110870
57008973810
60577577353
70930578752
54436509494
54846986821
...

result:

ok 50000 numbers

Test #21:

score: 0
Accepted
time: 43ms
memory: 19172kb

input:

500000 50000
zzzzp
zzzokzu
zzzo
zzzgat
wixda
zzz
zzz
zzz
zzyu
zzyeu
zzyd
zzyc
zzy
zzy
zzy
zzy
zzxv
zzxiyvj
zzxgq
zzxdve
zzx
zzx
zzx
zzx
zzwun
zzwtbqr
zzwqapj
zzwpq
zzvw
zzvo
zzvndzul
zzvj
zzvi
zzvf
zzvclx
zzv
zzv
zzv
zzut
zzum
zzu
n
zzu
zztu
zztn
zztc
zztazgkyuqdjg
zzt
zzt
zzt
zzt
zzt
zzt
zzsfsea
zz...

output:

70366145921
52083601785
57067631932
71474095298
66385255027
64269776686
71385044479
51406529543
57376202198
67076943999
62078447442
44936881360
69618064677
68181669986
70312104091
65320972902
78917957932
63214414652
73125596461
69206230102
56368399083
61037375218
75459707093
58150109109
69767608732
...

result:

ok 50000 numbers

Test #22:

score: 0
Accepted
time: 52ms
memory: 14736kb

input:

105832 50000
bqdhpsmiodarrbmbu
iuqanbex
bbupgrxhsjdpxt
flqkxhvy
wkbiyeqzh
xmduxplqoe
ivyknkqn
vylg
zxaammpb
pgeupj
zxaadneqdz
eucbuyzbz
vwycigi
hvyzopah
seqvhvcwefukerctjx
seqvarhstkzh
nbvhrqhjyi
seqvlcxoxdp
mxovglhrhk
zxhslwg
wkbzrok
fqryhy
seqvarcyeryf
xmospesva
faxhfrz
gclxtq
cwbieqjhsed
seqvhvti...

output:

2808482999
2799398988
2799539572
2796826522
2800073105
2801520641
2796336490
2804853986
2788201967
2806221048
2808482715
2798243940
2797384566
2797767894
2795519983
2800210127
2799848021
2792117611
2804232218
2797157259
2795814864
2813297868
2795434350
2802443252
2796744269
2804248611
2811277658
280...

result:

ok 50000 numbers

Test #23:

score: 0
Accepted
time: 50ms
memory: 16984kb

input:

107338 50000
joadzezbs
joadzoggvmrqzp
xwitvqohqnczjjs
wefpbqlculcwfq
yuquaghr
qfvojt
llqripx
llwxzuexoe
quoru
jicgbxwstx
hcgcnvotfnnnbie
tjvxrelwkdd
zndqdrt
kspbiva
bvrycdm
insrkyion
tjvxfzshfdkd
jicrwolkse
llwxgqbpbymqc
yuxnfbmytv
yuxzzikry
llqfqvcn
xxnirowixk
cuo
llwxoczhphax
yprivgmkfo
dijxiud
zn...

output:

2868950621
2873113602
2889901811
2882900531
2877069847
2886979579
2887671587
2874561369
2876458629
2882767274
2880278329
2883023296
2883825928
2892734774
2871461102
2874658850
2872991757
2888584265
2884216003
2883289840
2872339867
2878440715
2879396736
2886447496
2880801298
2873800995
2872520411
288...

result:

ok 50000 numbers

Test #24:

score: 0
Accepted
time: 46ms
memory: 14592kb

input:

84471 50000
amjjuxpqqps
sfjlrwitwp
mnvzltuun
erjujoqzl
gwbrdi
voujoxqtww
nkazwxdncthc
kixuecqghnd
amjjuabcm
kixuwzddrrq
amjjuptcbxescnpy
vhvcti
gwhobplw
qwromliji
ameiknays
ofzejjnbumj
ofzebzxg
iydethvzswc
kixjbyhsmxhg
lckzglvr
tmyjocjf
iuswwkbwjcoonz
tmyjjmd
fotfk
sfachdlg
amjjumupg
lpkpelihkc
lpmj...

output:

1785262459
1786330822
1786664333
1783058389
1780471448
1782801967
1782307223
1790343756
1788166300
1792429103
1779240824
1783753108
1787066807
1787873844
1784308889
1778230031
1785755485
1788836653
1787151557
1788718425
1788692992
1782395597
1786493829
1782640611
1789811040
1793688791
1778285426
178...

result:

ok 50000 numbers

Test #25:

score: 0
Accepted
time: 54ms
memory: 16572kb

input:

103054 50000
gkzmqsmhaz
qrmvxuguw
qjmlipb
sysqzcxsnkvan
kgagswzatep
cihjyfvvwppotoi
umifijyzxga
qrmvxkiall
qrknoamkqw
rxupxtrhedmloz
tiyhhpprot
cihjyzljt
cihhijwhktxki
dpjjpwnca
fzjzbm
fjgzorcdas
cihhphrodjxiipbxjfl
cihjylsnlse
cihslpgnja
pjuszotj
kiayaebomad
cipxmgddl
qxotcs
cihjyzlsgbbfrr
kiayaeyp...

output:

2653158658
2655323329
2653168329
2656994725
2650736704
2654821348
2648797929
2654071466
2656592860
2661631968
2656762736
2655697733
2650880132
2668273326
2652125912
2649097508
2660674934
2651935995
2654761601
2660157220
2657550671
2653325415
2652592693
2647249626
2657134693
2655747426
2648382025
266...

result:

ok 50000 numbers