QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#479770#266. 广义后缀自动机Justin#AC ✓111ms238360kbC++14884b2024-07-15 20:48:222024-07-15 20:48:23

Judging History

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

  • [2024-07-15 20:48:23]
  • 评测
  • 测评结果:AC
  • 用时:111ms
  • 内存:238360kb
  • [2024-07-15 20:48:22]
  • 提交

answer

#include<bits/stdc++.h>

using lld=long long;

const int N=1e6+5;

char c[N];
int n;

struct Node{
    int fa,len,ch[26];
}sam[N*2]; int lst,pnd=1;
lld ans;
void Ins(int x){
    int cur=++pnd,p=lst,q; sam[cur].len=sam[lst].len+1;
    for(;p&&!sam[p].ch[x];p=sam[p].fa) sam[p].ch[x]=cur;
    q=sam[p].ch[x];
    if(!q) sam[cur].fa=1;
    else if(sam[q].len==sam[p].len+1) sam[cur].fa=q;
    else{
        int r=++pnd; sam[r]=sam[q],sam[r].len=sam[p].len+1;
        for(;p&&sam[p].ch[x]==q;p=sam[p].fa) sam[p].ch[x]=r;
        sam[q].fa=sam[cur].fa=r;
    }
    ans+=sam[cur].len-sam[sam[cur].fa].len;
    lst=cur;
}

std::vector<int> e[N*2];

int main(){
    int T; scanf("%d",&T);
    while(T--){
        scanf(" %s",c+1),n=strlen(c+1);
        lst=1;
        for(int i=1;i<=n;++i) Ins(c[i]-'a');
    }
    printf("%lld\n",ans);
    return 0;
} 

详细

Test #1:

score: 100
Accepted
time: 76ms
memory: 195688kb

input:

16854
dbfbkkafejhhdnicdljkgbaanjhaehbgbjihdaillhnabangegbfmgaijfee
ebaffeadeddebcefdbfbddaafbbecbacaeefcfdabccdeaabfbadcdcdffdd
lflglkkeehkaglgakbgabhggfgfkdkhhcildbidaflgfffjdcbhbekbkhbddi
edeiihegdchicgdggbiaegbbhffgiehdcbfagfcaceggeehdggchccbb
bjglnggimjnknbaeagcmfollngfjgmikcmcioeeffbchknfnlaiad...

output:

23749949

result:

ok answer is '23749949'

Test #2:

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

input:

7669
cedkkifidiefdbfbcjabkcbdcifhajcficehkfiidfdaeceibiaikjdediecekcbihhbkdbjhcecbghgbkehicgeabfgikiijihihjhhdbkjijchfjedageficfgcaagdghg
oefeabmeuufjpmmibcuvqaqtmfuefrcioaqtqiqrangnfwplkeswnribmvejjvlmgjdfunrclowjwctumeoaiwtpoaiegmvsccklrcdjorhnqhgovoghhsfkrcdoanhq
aeedaeaeaaadddbbbadabdcbadddbbebb...

output:

57799793

result:

ok answer is '57799793'

Test #3:

score: 0
Accepted
time: 65ms
memory: 195536kb

input:

16303
cjhrprqdfcapeaaqdiracoaahsbaibgknntacpqkhtcphsklqdflsledhjr
dcfbdefcgfedeaebceadeeeabcbedfaefdebadabcffacecdeeccdaaggga
badacaadacbbaacbacbdabaddddadbbdbcacdcdcccbcaddcabbdbbacaaaccab
dqhfhdqlfncictdekmvtmqbonhchdbbjqocbdveovanqdbrpcaqekclaso
wqwpytgspzmrzbkhjcptzmijrphunyyehquhcalcbhpdjrjebkb...

output:

24767366

result:

ok answer is '24767366'

Test #4:

score: 0
Accepted
time: 67ms
memory: 183516kb

input:

40292
aaaaaaaaaaaaaaaaaaaaaa
ibbgbhbhflafhcegickcblef
aeabeebaecccecaacddeebcccd
iamebukjlqboetcabbeqpeuqa
cuauhsdchmsavllgpmstsymycg
vamnscovqvwmbijklralieh
hogfmeigpgckdbohllaof
cccikicbgfgjiggjcijfmha
idprphjhgvlolscmwjeaim
aaabcaacaccbcaacbcbcaa
oltewmxvojyauhijpwujc
gaimfkafahafkfkgehbkbeajl
xh...

output:

7321836

result:

ok answer is '7321836'

Test #5:

score: 0
Accepted
time: 99ms
memory: 195524kb

input:

14790
iebjifeiddjebdeffebbdjkjfkagejdbjdbdidcjghbjbifkhghecikeaekcefefghjc
kaeiklmadmdllijbokmmfodfenhhamloponmbolmphciincocpkhhckdfldpmapl
nsapmmhijmlmiiafsgqgnqhcalegbshtbrbfbdoinqeqrtdisjkgepqdejdfagpli
dacbbaadbddcdacbbdabbbcdccbdabdaacbcddabbcccdadddbdbbadbdcbbaacacb
fhecdmdmeijceiiamcjlldjmeek...

output:

27533013

result:

ok answer is '27533013'

Test #6:

score: 0
Accepted
time: 80ms
memory: 191788kb

input:

31942
fjdghflekibgggabkbcaedgldjklkbljf
kendafnjkigdeckgogqakmpglhkp
fadhdkihqsjofajkjfmdmpgksjesqclq
hidfjeifhcjejkbkbfamhmglgkfeddcnh
dgbjdebbfjgedeggbfjhgefggiaab
ebbbeaedaeabeadeeabbdcbaaecca
cbdfggdecaggehddfebacaecahffddcdh
eqdnlcqjklgldbaqibmecbklhenj
onelfmgdpjhnnlbfjpdbnaecjfpj
dbceeceaeddf...

output:

10679241

result:

ok answer is '10679241'

Test #7:

score: 0
Accepted
time: 70ms
memory: 183960kb

input:

44576
djmtdsnmedihgdgmonrr
bgcrtdbelgbnaotklht
cimfbcabdejefhaiimggg
cecddeageaafccdddefbf
jdlfcnidklhfdfideee
crtewbcgbqjgbibbqfdld
aihadejflleikellhjd
ebcdebeeaaaebbdacdee
aaaaaaaaaaaaaaaaaaa
babbbaabbbccbbbbcaabaaba
imkggkkkdmaflemeeffbkf
ibnngbupkcnhlrqqhsnmhl
defebbdadaeabccfbeffcd
weiyxmcprsuz...

output:

6536763

result:

ok answer is '6536763'

Test #8:

score: 0
Accepted
time: 82ms
memory: 199256kb

input:

6476
jjfcfbcaabhbhhbacgagjjidjabfjcbbhecgcbdgbbghjhcejjjdhefehcbiiefabjadajfighdjgfaiecijhbfbfacgjcfaedejejffjaegbfjggcegggbihfedehfgbhajhaifdieeiibgdjeggccebfdg
ckbakhcficaciaecbccdeejekbceehiiikdhdabgbbjhhjhdccecibaihdbgkjjbjkbjdkhegfajdjecicbcdfbcbbibibebbggegieikfabfgeedgjcfgfbekicechhedcacgibch...

output:

69112648

result:

ok answer is '69112648'

Test #9:

score: 0
Accepted
time: 59ms
memory: 185472kb

input:

44343
wogvpxrljvltdwzcqdey
abbbbfbbbddebedecfaee
ahaiilkbelijigfadci
aplnqearljlegojejke
kneodlkflijjbijnpjopbmi
behbehbgjdeaifihjehh
adkjifcjjdbkkledeabkfm
sscjodcnkoogqjpbmsoqgmh
lgdpiiqlhhcoaedoajga
idedhdeedbleflhedlh
hikdgfekfjjciijkdkek
bbbbbcbabacbbbaaaababcbc
fbhbfeadbghcbebeccggiegc
nfeqovi...

output:

6505168

result:

ok answer is '6505168'

Test #10:

score: 0
Accepted
time: 65ms
memory: 184192kb

input:

49659
egbcjgakcagkkelfkbfhhc
ibekgejgeikfbfbddd
aaaaaaaaaaaaaaaaaa
irobkkijqchelckoe
ccccbcbbcbcbabcabca
hechfcfdgefgcaeggf
babbbbabbabbbbaabbabb
nmggfudhtkdnotnfecrutg
ljhtbkljbdqbsmakp
ddbccacbbbacdccdaaabad
aaddagbedaafabebfe
qgdgivhkarbegcgcqn
tatkdtptpsnloopcenmp
abcnbgkuajowldgldgn
ngrflrnaflp...

output:

5713177

result:

ok answer is '5713177'

Test #11:

score: 0
Accepted
time: 87ms
memory: 205172kb

input:

628
imlhecgjgjjgdbkgkkcciaefdlbmigciflhclkgfjhechjfdfeaggfmjjambjfkailfiiijffcmahhcagkdgiadmmhijcjeigebfkgmjbacckccejahajjgkcbdhmbjjdfaihiehghbekcifkmelhgdggkkebkfcliafmlmdmagekkldaebieclcfaedlhhjabaekfbbekfcifkkdcjkhkdklfakfklbimilkklgeckcjablailjkefcibklmmedlmbjedehibkglbfiejhkmdmggedaelkiaidlcdig...

output:

765629388

result:

ok answer is '765629388'

Test #12:

score: 0
Accepted
time: 70ms
memory: 201940kb

input:

30
hgffjacdidjhihabhbjdghkbakhdgbackkkbciggaefageeegdejbhcigacbjdjiagfaigdfeibgjkajjkdbkgfeibjfkgcifbgagafjgdikijkehcjfhhdijjehcckhjecjkiehiadbafcehbabchdefbigcgfadcdikckbeafijhhjjbfjgjbibihfghejdhacigibcjhkgjajaidhifbbbidbfehcgdadchcjkfghdjjaffadcbgcjiahkjgkdjifaikdebiffjiiecajbaeachccedaijecdfehjk...

output:

16661663625

result:

ok answer is '16661663625'

Test #13:

score: 0
Accepted
time: 83ms
memory: 213992kb

input:

3
lbmoibeicoablgmjjbejhkkngmjmgkdnfecdnjldmjiooehhjfldjnebakimfahndkjdlenfeccjhlimdiohcgjdjbecfjgjcedmadkmedofdajjkfkmohnbnikdhclhkhnladcihkafkmahekihlbdmkhdfdcfikjnodmajbbbicacbonlaaegnokfnaandblgkjhgglggchbhdfgcldakclinfioeomglejhikkjdcdbdkcddhcoahfnbgnidfochnmcgmbjcngohkheioholkfglcamhcjbfaagaejj...

output:

166660584606

result:

ok answer is '166660584606'

Test #14:

score: 0
Accepted
time: 81ms
memory: 205404kb

input:

93
oifqpcdugracedbugpohduedtegfaprfubtfogerrndkfnrcgjeeuceeouooamdemsblcbrsptoanbgbqqejalskbfqcjtrudhmigbqhauvtjoccvtqjhlchtsmdoqvfjkoqkpqfkeqbipmchtsbscfghiickhikmautpltmekbimpdntljoqbhqnphqncerpahshqibfumukegmqctdkklmdmrutarvkglsdonnqllshjakipafibkanhvfuakvjdnhjdgqgskdmbqfhbgrsijbpfotndktspdjqaggo...

output:

5197291378

result:

ok answer is '5197291378'

Test #15:

score: 0
Accepted
time: 88ms
memory: 203040kb

input:

419
bbdaeabebddadbbeedbacabbbecdbeacdadbaebdcedcbebcbbbebbdbccedcbaccdcdaadeaaaecbaccdcdbecddebedcabbdceeaaebeebcbaadbbcbadccedabdbbeedbeaaddbdeadbbceeacbebacabcbeceedddedbbaddeabdeceeaaaacbccbcabeaeadbaaacaaadbeeabadeecdecbdeacaacdbcadbaebebcdebdeebecbdedaabdacddaabacedcddbdeddbbdcaecbabdeebeaebdbb...

output:

1145009288

result:

ok answer is '1145009288'

Test #16:

score: 0
Accepted
time: 24ms
memory: 161940kb

input:

214
azqbeguwsevbuncqaroqgazqbeguwsevazqbeguwsevbuncqaroqgazqbeguwsevbuncqaroqgazqbeguwsevazqbeguwsevbuncqaroqgazqbeguwsevazqbeguwsevbuncqaroqgazqbeguwsevbuncqaroqgazqbeguwsevazqbeguwsevbuncqaroqgazqbeguwsevbuncqaroqgazqbeguwsevazqbeguwsevbuncqaroqgazqbeguwsevazqbeguwsevbuncqaroqgazqbeguwsevbuncqaroq...

output:

1151326618

result:

ok answer is '1151326618'

Test #17:

score: 0
Accepted
time: 27ms
memory: 165948kb

input:

7224
ajwgyefdzbbjhvniphuajwgyefdzajwgyefdzbbjhvniphuajwgyefdzbbjhvniphuajwgyefdzajwgyefdzbbjhvniphuajwgyefdzajwgyefdzbbjhvniphuajwgyefdzbbjhvnip
aaswomqmzlgbmxjwjruuaaswomqmzlgaaswomqmzlgbmxjwjruuaaswomqmzlgbmxjwjruuaaswomqmzlgaaswomqmzlgbmxjwjruuaaswomqmzlgaaswomqmzlgbmxjwjruuaaswom
apcbdqgyhybfzap...

output:

39236949

result:

ok answer is '39236949'

Test #18:

score: 0
Accepted
time: 34ms
memory: 166496kb

input:

11278
alcrkrftlkbxzpcebwxxalcrkrftlkalcrkrftlkbxzpcebwxxalcrkrftlkbxzpcebwxxalcrkrftlkalcrkr
asfgdlqsovkbsnkasfgdlqsovkasfgdlqsovkbsnkasfgdlqsovkbsnkasfgdlqsovkasfgdlqsovkbsnkasfgdlq
aobfgcdvtuasaoaobfgcdvtuasaobfgcdvtuasaoaobfgcdvtuasaoaobfgcdvtuasaobfgcdvtuasaoaobfgcdv
auubvwtruncjauuauubvwtruncja...

output:

26413999

result:

ok answer is '26413999'

Test #19:

score: 0
Accepted
time: 27ms
memory: 165300kb

input:

33
apqjmltfbygopeezfapqjmltfapqjmltfbygopeezfapqjmltfbygopeezfapqjmltfapqjmltfbygopeezfapqjmltfapqjmltfbygopeezfapqjmltfbygopeezfapqjmltfapqjmltfbygopeezfapqjmltfbygopeezfapqjmltfapqjmltfbygopeezfapqjmltfapqjmltfbygopeezfapqjmltfbygopeezfapqjmltfapqjmltfbygopeezfapqjmltfapqjmltfbygopeezfapqjmltfbygo...

output:

7426319363

result:

ok answer is '7426319363'

Test #20:

score: 0
Accepted
time: 12ms
memory: 165356kb

input:

28
aechgbxrexqdgusaechgaechgbxrexqdgusaechgbxrexqdgusaechgaechgbxrexqdgusaechgaechgbxrexqdgusaechgbxrexqdgusaechgaechgbxrexqdgusaechgbxrexqdgusaechgaechgbxrexqdgusaechgaechgbxrexqdgusaechgbxrexqdgusaechgaechgbxrexqdgusaechgaechgbxrexqdgusaechgbxrexqdgusaechgaechgbxrexqdgusaechgbxrexqdgusaechgaechgbx...

output:

8721480282

result:

ok answer is '8721480282'

Test #21:

score: 0
Accepted
time: 88ms
memory: 217752kb

input:

1545
eacfddfabffdfdbbgbcdbgfbfbeccffdddgdagaaaccaaffcabcdcddabcdcdafacddcbbaeafcbbadaefbbbbfffaafgfbbcbeafdegdedbffaccaaffcabdcafgefbfabbggaccbabgggcaadbgcfeefgaceddaaceabdabeedgcebebcgaaceabdabebfcafdeaaacdcddabcdcgdacggedaacdcbfeabgfbageggacegbbggaccbabgebfegbecaefcgbbdgdafeefgacedddfcddfeggcfdege...

output:

316540941

result:

ok answer is '316540941'

Test #22:

score: 0
Accepted
time: 93ms
memory: 215236kb

input:

2916
gdebacaacfebadgdafeedgeadfaebagefffefbggdabcedfegaggdfagdfafdbbffgcfeaedebbbebegedefgeefcgaeccfebbgbedefgeefcgdddfdaedebcdggcggcddgcaecaeeabagabeebfgbaegcfcbaaaedefgeefcgbedbdbcadbdbbffgcfeabfbbadbaaaggdfagdfafeeecfaaeageebfcafedddddfdaedebadgbgdbgcaeebfcafeddffebfeeafdfadfefbadceefgcbabeaffefe...

output:

163900615

result:

ok answer is '163900615'

Test #23:

score: 0
Accepted
time: 32ms
memory: 216996kb

input:

616
fbcdedbfdgcffbcdeadgdbafecgccbbdgcgagcadaefbbdcbcbbdgcgagcadffgfgdgbefgggeadcfcbecefbdfebbfdgffegedbgeacecbeecgefcfaeaefbaddcbaebcbaddcbaebcdbedeedcfcfbdbcfaaeagceccdbbdcecefbdfebbffgfgdgbefbabbdabadfdegaecfgeccffbcdeadgfdgffegedbfbcdedbfdgdbecgdcdedfdgffegedbgceccdbbdcabeabdffbagceccdbbdcbdddaf...

output:

803953105

result:

ok answer is '803953105'

Test #24:

score: 0
Accepted
time: 12ms
memory: 164388kb

input:

487
aaaaaaaauouaaaaaaaauouaaaaaaaauouaaaaaaaauouaaaaaaaauouaaaaaaaauouaaaaaaaauouaaaaaaaauouhdnbkzzxpcaaaaaaaauouaaaaaaaauouaaaaaaaauouaaaaaaaauouaaaaaaaauouaaaaaaaauouaaaaaaaauouaaaaaaaauouhdnbkzzxpcaaaaaaaauouaaaaaaaauouaaaaaaaauouaaaaaaaauouaaaaaaaauouaaaaaaaauouaaaaaaaauouaaaaaaaauouhdnbkzzxpcaa...

output:

452762759

result:

ok answer is '452762759'

Test #25:

score: 0
Accepted
time: 15ms
memory: 162260kb

input:

3
aaaaaaaammgaaaaaaaammgaaaaaaaammgaaaaaaaammgaaaaaaaammgaaaaaaaammgaaaaaaaammgaaaaaaaammgaaaaaaaammgaaaaaaaammgaaaaaaaammgaaaaaaaammgaaaaaaaammgaaaaaaaammgaaaaaaaammgaaaaaaaammgqejhwqijvmqfrlaaaaaaaammgaaaaaaaammgaaaaaaaammgaaaaaaaammgaaaaaaaammgaaaaaaaammgaaaaaaaammgaaaaaaaammgaaaaaaaammgaaaaaaaam...

output:

56482697969

result:

ok answer is '56482697969'

Test #26:

score: 0
Accepted
time: 11ms
memory: 163340kb

input:

958
aaaaaaaaaaaaaaaaencfjaaaaaaaaaaaaaaaaencfjaaaaaaaaaaaaaaaaencfjaaaaaaaaaaaaaaaaencfjaaaaaaaaaaaaaaaaencfjaaaaaaaaaaaaaaaaencfjaaaaaaaaaaaaaaaaencfjaaaaaaaaaaaaaaaaencfjaaaaaaaaaaaaaaaaencfjaaaaaaaaaaaaaaaaencfjaaaaaaaaaaaaaaaaencfjaaaaaaaaaaaaaaaaencfjaaaaaaaaaaaaaaaaencfjaaaaaaaaaaaaaaaaencfjaa...

output:

224593548

result:

ok answer is '224593548'

Test #27:

score: 0
Accepted
time: 32ms
memory: 167452kb

input:

12095
aaaamfkaaaamfkaaaamfkaaaamfkaaaamfkaaaamfkaaaamfkaaaamfkciokmombaaaamfkaaaamfkaaa
aaaaaaaaaaaaaaaafligyaaaaaaaaaaaaaaaafligyaaaaaaaaaaaaaaaafligyaaaaaaaaaaaaaaaafligy
aaaaaaaafsmaaaaaaaafsmaaaaaaaafsmaaaaaaaafsmaaaaaaaafsmaaaaaaaafsmaaaaaaaafsmaaa
aaaaaaaamuvaaaaaaaamuvaaaaaaaamuvaaaaaaaamuvaa...

output:

15304035

result:

ok answer is '15304035'

Test #28:

score: 0
Accepted
time: 33ms
memory: 167160kb

input:

15357
aaaaaaaakcuaaaaaaaakcukkjnwaaaaaaaakcuaaaaaaaakcukkjnwaaaaaaaakcu
aaaaaaaaugiaaaaaaaaugiaaaaaaaaugiaaaaaaaaugiaaaaaaaaugiaaaaaaaaugia
aaaaaaaaaaaaaaaaonnpjaaaaaaaaaaaaaaaaonnpjaaaaaaaaaaaaaaaaonnpjaaaa
aaaaaaaaaaaaaaaaczacjaaaaaaaaaaaaaaaaczacjaaaaaaaaaaaaaaaaczac
aaaaaaaawwfaaaaaaaawwfaaaaaaa...

output:

12407081

result:

ok answer is '12407081'

Test #29:

score: 0
Accepted
time: 96ms
memory: 230840kb

input:

8821
hhhhhhghhhhghhhhhhhhhhhhhfhhhhhhhhhhhhhhhhghhghhhhhhhhhghfhghggghhhhghhghhhhhhhhhhhhhhhhfhhhhghggghghghhhhhghhhhhh
hhhhhhhhghhhhgghhhhhhhhgfhhhhghhhhhhhhghhhhhhhhhhfhghghhhheghhhhhghhhgghhghhhhhhhhhhhhhhhhghhhhhhghhhhhhhhhhehhhh
hghhhgghhhhhhhhhhhhehghhhhhhhfhhhgghhhhhhhghhhhhhhhghfhhhgghhffhgh...

output:

39996161

result:

ok answer is '39996161'

Test #30:

score: 0
Accepted
time: 63ms
memory: 200256kb

input:

26075
hhghhhgfghhghhghgghgghhhhhhhhhhhhdhghh
hhghhghhhhhghhhghhhhhhfhhhhhghhhghhhghhh
hhhghhhhhhhhhhghhhghhhhghghggfghhhg
hhhfhghghfhhhhhhhhhhghhhggghhgggghhhhh
hhggfhgfhhfhghhghhghhhhgghghgfhhgghhh
hhhhghhhhhgfhhghhhehgghehhhhhghhghhhd
hhhhghhhhhghhhhhhghhghhhhhhghehhhhhhh
ghhhghhhhghhhhhhhhhhgghgh...

output:

6002528

result:

ok answer is '6002528'

Test #31:

score: 0
Accepted
time: 83ms
memory: 222896kb

input:

12457
lkljlgkllljljklkllljlljljlllkllllllllllljllkllljllllkjkllllllkillkkllkjlkkllkl
llklklllkllilljjllklkljlkjlllkkllkllkkllllkkjjlklllllllkklllllkljllkljlilkllljklll
llklklllkhljjlljllljlljljlllllklllklkklllkllklllkllllllkljllllllllkkllllllllk
llllllkllljkllkjkllllkllllllklllkllikkkllkkglllllkllll...

output:

27420733

result:

ok answer is '27420733'

Test #32:

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

input:

13968
lkllllkjllllllkllljkjljkkllllkllklllklkllllllikllkllllllkillkklkklhk
llljlilklllkllllilkklllllkkllkjlkkllllllklkklljkklllkklkliljlkjllkllllj
lkkllkllkllklkkkjlllllkkkllklhkkklkjllllklllkljllllkklllljljllklkllllllll
lklllkllijlkjlllljllkkllllllllkklllkkllklllllllljllklllllljllhlllllllk
lljllklh...

output:

23006835

result:

ok answer is '23006835'

Test #33:

score: 0
Accepted
time: 111ms
memory: 234944kb

input:

1424
kllklkkllkklkllllllllllkllllljlkllilljlkkkklkllkllljlllljllljklllljkkliljllllklklllkklllllkllljlllklklklklklllllkjljkllllklllliklljlklllllkllllllllllklklllklllllklllllkjlklljjkllllllllllkllkllllllllklllljkllkljlklkljjlljlkkllkkllllkklllllklkllllllllllkllllllkklllllllllllkklkklllllllklkklkllkllk...

output:

336960929

result:

ok answer is '336960929'

Test #34:

score: 0
Accepted
time: 106ms
memory: 238360kb

input:

389
jllllllkljkjillljlllkkllljlklkkllkkllklkkjlllklkllkllllljlllkkklkklkllllllklklkllilklkllklllkjllkkllllkllklkkljkklllllklkjllllillllljkljlllkllljlkllllllkljklkklllllkljlklllklllkikkllkkjllkllilkllkljlllklkllllkkkllkklllllllllilllljilkllkllllllljlklllllllljjkllljllllkilljlkllllljjlkklkjllkllllllkl...

output:

1270722646

result:

ok answer is '1270722646'

Test #35:

score: 0
Accepted
time: 111ms
memory: 237824kb

input:

1
lljllillllkklllklkllllllllllkllkillllkllllklklklllllljkilllllkkkjlllllkllllkklkklllllelkljkklllljlllllllllljllkllljllllljlkkllkkkjllkllllklllllklklkhlllklllllllklljllllklllkllllkgjlkklllllkklllliljlllkkkllkklklllkkllkkjkllllljlkkllklllkjklkllkllklllljkjjlllllllllkljklklllklllilllklkllklllklkllllll...

output:

499986467945

result:

ok answer is '499986467945'

Test #36:

score: 0
Accepted
time: 108ms
memory: 236140kb

input:

557
lllllllllkllkllkkllllllkhlkkjllllkllklkllllkjllkklljlklljllllllljkllliklllilkkjllkllllljllljlllkjlljjjklllllljkkkklljllljlllljjllljllljlllllllllllllkllklflllllljklllllkllljkllljklkklkjllllllkklllllkikllillkllijlllkkllllljlljljjkllllkllllllllllkllkljlllllillllllllllkillkjljklkllillklllllkljllllll...

output:

883262766

result:

ok answer is '883262766'

Test #37:

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

input:

72044
aaaaaaaaaaaaaaa
aaaaaaaanloa
lklkllkljkllll
inhorbdfrf
lklillljkkklli
afccbddgbabgbg
klllljlllll
dfegbcgdebcecgb
fngnnclqobnl
totgkbmwwwjdu
aaaaaaaazcq
aaaaaaaaaaaa
biajdbchegbhkkn
ddacegbabg
axkplrbipxxkhw
ahdkgbbhab
aaaaaaaadeoaaa
aaaaaaaamfs
cfaecddccbabed
lllkkllkkl
dgabccdegd
klllklllkll
...

output:

2061320

result:

ok answer is '2061320'

Test #38:

score: 0
Accepted
time: 39ms
memory: 169836kb

input:

79950
arldbnfksvarld
aiiwkbjtd
kjinknnini
aaaaaaaasnda
llllklllklll
aaaaaaaamnk
jllklillklllll
atbbdpbvaqaa
akibndtnlfeaki
ljllllkllklll
aabbdgdgcgcgff
kllllllllkll
dgbfaebedeb
ilklikklkklk
bccdaaaee
aaaaaaaabaqaa
agfbcagfgfcegb
ggcdgadceacdg
aydbpocrgtay
dddbcfedc
gbgffdfeffa
aaaaaaaawn
lllllllilll...

output:

1805568

result:

ok answer is '1805568'

Test #39:

score: 0
Accepted
time: 67ms
memory: 194284kb

input:

3628
aaaaaaaacmyaaaaaaaacmyaaaaaaaacmyaaaaaaaacmywwwyyneaaaaaaaacmyaaaaaaaacmyaaaaaaaacmyaaaaaaaacmywwwyyneaaaaaaaacmyaaaaaaaacmyaaaaaaaacmyaaaaaaaacmywwwyyneaaaaaaaacmyaaaaaaaacmyaaaaaaaacmyaaaaaaaacmywwwyynevwnjssfgatjkuxyaaaaaaaacmyaaaaaaaacmyaaaaaaaacmyaaaaaaaacmywwwyyneaaaaaa
aakmaakmaakmaakmaa...

output:

103987512

result:

ok answer is '103987512'

Test #40:

score: 0
Accepted
time: 60ms
memory: 194204kb

input:

12813
aaaaaaaaaaaaaaaaiddesaaaaaaaaaaaaaaaaiddesaaaaaaaaaaaaaaaaiddesaaaaaaaaaaaa
aaaaaaaawsoaaaaaaaawsoaaaaaaaawsoaaaaaaaawsoaaaaaaaawsoaaaaaaaawsoaaaaaaaawsoa
asecbauzasecasecbauzasecbauzasecasecbauzasecasecbauzasecbauzasecasecbauzasecbauz
daahekajbnookaegclmcggkffpmcopnmjclpmlgildkmgclpnkgpgpclen...

output:

26912166

result:

ok answer is '26912166'

Test #41:

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

input:

2
gdcfddceadedgcfgdgcagafbdabdcefcabcafcdggfgfddefdgcfgaebbbbdceggcbddfbgaeggadfbcgafbdabdceeadegegcggedffcccbbecafdgdfdbfgafbdabdcegcbdecdffdccaeecfgecbdaafddccfcaadgagedccfceadabfeegcdeccdaccaadgagedcabafgfcgggedffcccbbecafdgdfdbfdfegccdggcdgfdccgabefbcbacadfafcabcafcdgcfceadabfeceggcbddfbgdcfddce...

output:

249980713640

result:

ok answer is '249980713640'

Test #42:

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

input:

6
llklklllllllllkljkkllljllklikkikjilllljlllkkilllllklllljllklllkjlillljilllkllllilllljlkllllklllljklllklkkkllllklklllllllllllklllllillkkhljkllliiklllllklllkllllljlllllljlkllllkllllelljlkljllllllllllklkjlllkljllllilllklkkkflllkllkllkkllllllllklllilklljlklljlllllkljjjlkllljljlilllllklklkklljkljllilkl...

output:

75007300766

result:

ok answer is '75007300766'

Test #43:

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

input:

11005
illllkkllllllljlllllkljlklkllllklllllklkllllllkklllklkllklllklllllkklllkllljlllhljjllklllll
lllklkljllkillklkljlllklllllllllljlljkllllklklklllllllllklllljkljlllllllklkkjllllllllijllll
lllljllkklkkillllllkllllllklklkkjlllllklllllllljlllllkllklllkllillllkiljlkllklkkjklllkkk
aaaaaaaaqzzaaaaaaaaqz...

output:

31075980

result:

ok answer is '31075980'

Test #44:

score: 0
Accepted
time: 49ms
memory: 195160kb

input:

168
edfdgadafegedbfbeefccfebdfebfdbfgcadbbecedfdgadafedfdeegdgbabebefdccdfbgegcaggacfacccabbggcacdbfcccbdfgbadeffabcbafcedggffdbgagfbdfdcfccagggdafeedfebdcdfcggdgdcgbgfcaefeddcecggbefccacdbfcccbfcfcdccbdcbeafdeefeddfdeegdgbabfgcadbbecaaeacdcdaaefffedgdedfcfgcedabbfffdaeecadbcbafcedggbgbaaccdfdbgegca...

output:

2221581860

result:

ok answer is '2221581860'

Test #45:

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

input:

34
lkllllllllilljkllllllkkjllllllllkiljkklkklklllllkkllllkllkljgllkliklllkllkllllllklllljlklllllklllllllljlijklklllkkklkjlllllklllllljllklllljlkllklllljllejlllllllllklllklllkljklljikjllllllllljllljllkklllllllllllllllkllllkllllllhljlllljlllkllkllkllllklllkillkkljlljlklllkljkllllljklllllljllllkkklllll...

output:

11609354185

result:

ok answer is '11609354185'

Test #46:

score: 0
Accepted
time: 36ms
memory: 196228kb

input:

1093
lllllllllllkjllllklkklllkkljllllkkjlklllllkkllllklllkllllllkllkllllklkllkkjlljlllkklllliklkiljklilljllljlllhlkklklllllkllkljililllkllklllllkllklllllljlllllkllkllllljlllllllklllkklkllllkllllllklllkllllhkkllljllkllllkkllkljlllllllllkkllllllklllkllkllllilkllljlllllljjlljjklkklklkjlljkllllllllkllll...

output:

354111743

result:

ok answer is '354111743'

Test #47:

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

input:

71
jlkllkklllllkkklilkllkllllllllllklllljllllljkklllllllllhllllkkkllkjkllllllhlllillllllkkllllhlklllllllllkkllkkkjlkklkllllllkjlclkjllllklkllkljlkllklkljkllllllllljlhlkllllkilklllkjllljljlkllllkklklllllllklllklkkjllkkklllhjlllllllkklllllkllkllllllkklfkljllklllljllkllllkllkkljllkklljlllllllllikllkkll...

output:

5329897030

result:

ok answer is '5329897030'

Test #48:

score: 0
Accepted
time: 49ms
memory: 197648kb

input:

308
jcicgcibjfhcedjjbefddaafdcfdjeadeefgcfhjjbjgdhcgjigdaaefjdcdgjdaagggbjbbjgjbcaijedaccgieedfahebheabcceijcaecabidjajijedfjaaggcghdjibjjicbhjafcdhigcbgeaedehajbcfhhadefcgibjigfiggiibghcjiabjajggcjgbabfbbdaeadhabheahfbhjbchbehiighabdcgaicfjiechaeddeaeejicifigdeaeicdieabefijcbffbfhhbijgiciihgcdeghac...

output:

1245588935

result:

ok answer is '1245588935'

Test #49:

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

input:

396
aaaaaaaawlkaaaaaaaawlkaaaaaaaawlkaaaaaaaawlkaaaaaaaawlkaaaaaaaawlkaaaaaaaawlkaaaaaaaawlkiwtpadegjxaaaaaaaawlkaaaaaaaawlkaaaaaaaawlkaaaaaaaawlkaaaaaaaawlkaaaaaaaawlkaaaaaaaawlkaaaaaaaawlkiwtpadegjxaaaaaaaawlkaaaaaaaawlkaaaaaaaawlkaaaaaaaawlkaaaaaaaawlkaaaaaaaawlkaaaaaaaawlkaaaaaaaawlkiwtpadegjxaa...

output:

992295088

result:

ok answer is '992295088'

Test #50:

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

input:

2312
abvfbqfgqbpllvmiabvfbqfgqabvfbqfgqbpllvmiabvfbqfgqbpllvmiabvfbqfgqabvfbqfgqbpllvmiabvfbqfgqabvfbqfgqbpllvmiabvfbqfgqbpllvmiabvfbqfgqabvfbqfgqbpllvmiabvfbqfgqbpllvmiabvfbqfgqabvfbqfgqbpllvmiabvfbqfgqabvfbqfgqbpllvmiabvfbqfgqbpllvmiabvfbqfgqabvfbqfgqbpllvmiabvfbqfgqabvfbqfgqbpllvmiabvfbqfgqbpllvm...

output:

163513482

result:

ok answer is '163513482'