QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#128401#266. 广义后缀自动机william555#AC ✓111ms194456kbC++14797b2023-07-20 22:30:242023-07-20 22:30:29

Judging History

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

  • [2023-08-10 23:21:45]
  • System Update: QOJ starts to keep a history of the judgings of all the submissions.
  • [2023-07-20 22:30:29]
  • 评测
  • 测评结果:AC
  • 用时:111ms
  • 内存:194456kb
  • [2023-07-20 22:30:24]
  • 提交

answer

#include<bits/stdc++.h>
using namespace std;
const int N=2e6+5;
int n;
char s[N];
int lst=1,tot=1;
int fa[N],ch[N][26],len[N];
void insert(int c){
    int p=lst,np=++tot;lst=np;
    len[np]=len[p]+1;
    for(;!ch[p][c];p=fa[p])ch[p][c]=np;
    if(!p){fa[np]=1;return;}
    int q=ch[p][c];
    if(len[q]==len[p]+1){fa[np]=q;return;}
    int nq=++tot;len[nq]=len[p]+1;
    fa[nq]=fa[q],fa[q]=fa[np]=nq;
    for(int i=0;i<26;i++)ch[nq][i]=ch[q][i];
    for(;ch[p][c]==q;p=fa[p])ch[p][c]=nq;
}
int main(){
    scanf("%d",&n);
    while(n--){
        scanf("%s",s+1);
        int m=strlen(s+1);
        lst=1;
        for(int i=1;i<=m;i++)insert(s[i]-'a');
    }
    long long ans=0;
    for(int i=1;i<=tot;i++)ans+=len[i]-len[fa[i]];
    cout<<ans<<endl;
    return 0;
}

Details

Tip: Click on the bar to expand more detailed information

Test #1:

score: 100
Accepted
time: 91ms
memory: 153460kb

input:

16854
dbfbkkafejhhdnicdljkgbaanjhaehbgbjihdaillhnabangegbfmgaijfee
ebaffeadeddebcefdbfbddaafbbecbacaeefcfdabccdeaabfbadcdcdffdd
lflglkkeehkaglgakbgabhggfgfkdkhhcildbidaflgfffjdcbhbekbkhbddi
edeiihegdchicgdggbiaegbbhffgiehdcbfagfcaceggeehdggchccbb
bjglnggimjnknbaeagcmfollngfjgmikcmcioeeffbchknfnlaiad...

output:

23749949

result:

ok answer is '23749949'

Test #2:

score: 0
Accepted
time: 102ms
memory: 155212kb

input:

7669
cedkkifidiefdbfbcjabkcbdcifhajcficehkfiidfdaeceibiaikjdediecekcbihhbkdbjhcecbghgbkehicgeabfgikiijihihjhhdbkjijchfjedageficfgcaagdghg
oefeabmeuufjpmmibcuvqaqtmfuefrcioaqtqiqrangnfwplkeswnribmvejjvlmgjdfunrclowjwctumeoaiwtpoaiegmvsccklrcdjorhnqhgovoghhsfkrcdoanhq
aeedaeaeaaadddbbbadabdcbadddbbebb...

output:

57799793

result:

ok answer is '57799793'

Test #3:

score: 0
Accepted
time: 91ms
memory: 150892kb

input:

16303
cjhrprqdfcapeaaqdiracoaahsbaibgknntacpqkhtcphsklqdflsledhjr
dcfbdefcgfedeaebceadeeeabcbedfaefdebadabcffacecdeeccdaaggga
badacaadacbbaacbacbdabaddddadbbdbcacdcdcccbcaddcabbdbbacaaaccab
dqhfhdqlfncictdekmvtmqbonhchdbbjqocbdveovanqdbrpcaqekclaso
wqwpytgspzmrzbkhjcptzmijrphunyyehquhcalcbhpdjrjebkb...

output:

24767366

result:

ok answer is '24767366'

Test #4:

score: 0
Accepted
time: 97ms
memory: 142920kb

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: 74ms
memory: 154424kb

input:

14790
iebjifeiddjebdeffebbdjkjfkagejdbjdbdidcjghbjbifkhghecikeaekcefefghjc
kaeiklmadmdllijbokmmfodfenhhamloponmbolmphciincocpkhhckdfldpmapl
nsapmmhijmlmiiafsgqgnqhcalegbshtbrbfbdoinqeqrtdisjkgepqdejdfagpli
dacbbaadbddcdacbbdabbbcdccbdabdaacbcddabbcccdadddbdbbadbdcbbaacacb
fhecdmdmeijceiiamcjlldjmeek...

output:

27533013

result:

ok answer is '27533013'

Test #6:

score: 0
Accepted
time: 75ms
memory: 144720kb

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: 81ms
memory: 142292kb

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: 61ms
memory: 153988kb

input:

6476
jjfcfbcaabhbhhbacgagjjidjabfjcbbhecgcbdgbbghjhcejjjdhefehcbiiefabjadajfighdjgfaiecijhbfbfacgjcfaedejejffjaegbfjggcegggbihfedehfgbhajhaifdieeiibgdjeggccebfdg
ckbakhcficaciaecbccdeejekbceehiiikdhdabgbbjhhjhdccecibaihdbgkjjbjkbjdkhegfajdjecicbcdfbcbbibibebbggegieikfabfgeedgjcfgfbekicechhedcacgibch...

output:

69112648

result:

ok answer is '69112648'

Test #9:

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

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: 59ms
memory: 142448kb

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: 86ms
memory: 160600kb

input:

628
imlhecgjgjjgdbkgkkcciaefdlbmigciflhclkgfjhechjfdfeaggfmjjambjfkailfiiijffcmahhcagkdgiadmmhijcjeigebfkgmjbacckccejahajjgkcbdhmbjjdfaihiehghbekcifkmelhgdggkkebkfcliafmlmdmagekkldaebieclcfaedlhhjabaekfbbekfcifkkdcjkhkdklfakfklbimilkklgeckcjablailjkefcibklmmedlmbjedehibkglbfiejhkmdmggedaelkiaidlcdig...

output:

765629388

result:

ok answer is '765629388'

Test #12:

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

input:

30
hgffjacdidjhihabhbjdghkbakhdgbackkkbciggaefageeegdejbhcigacbjdjiagfaigdfeibgjkajjkdbkgfeibjfkgcifbgagafjgdikijkehcjfhhdijjehcckhjecjkiehiadbafcehbabchdefbigcgfadcdikckbeafijhhjjbfjgjbibihfghejdhacigibcjhkgjajaidhifbbbidbfehcgdadchcjkfghdjjaffadcbgcjiahkjgkdjifaikdebiffjiiecajbaeachccedaijecdfehjk...

output:

16661663625

result:

ok answer is '16661663625'

Test #13:

score: 0
Accepted
time: 74ms
memory: 170100kb

input:

3
lbmoibeicoablgmjjbejhkkngmjmgkdnfecdnjldmjiooehhjfldjnebakimfahndkjdlenfeccjhlimdiohcgjdjbecfjgjcedmadkmedofdajjkfkmohnbnikdhclhkhnladcihkafkmahekihlbdmkhdfdcfikjnodmajbbbicacbonlaaegnokfnaandblgkjhgglggchbhdfgcldakclinfioeomglejhikkjdcdbdkcddhcoahfnbgnidfochnmcgmbjcngohkheioholkfglcamhcjbfaagaejj...

output:

166660584606

result:

ok answer is '166660584606'

Test #14:

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

input:

93
oifqpcdugracedbugpohduedtegfaprfubtfogerrndkfnrcgjeeuceeouooamdemsblcbrsptoanbgbqqejalskbfqcjtrudhmigbqhauvtjoccvtqjhlchtsmdoqvfjkoqkpqfkeqbipmchtsbscfghiickhikmautpltmekbimpdntljoqbhqnphqncerpahshqibfumukegmqctdkklmdmrutarvkglsdonnqllshjakipafibkanhvfuakvjdnhjdgqgskdmbqfhbgrsijbpfotndktspdjqaggo...

output:

5197291378

result:

ok answer is '5197291378'

Test #15:

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

input:

419
bbdaeabebddadbbeedbacabbbecdbeacdadbaebdcedcbebcbbbebbdbccedcbaccdcdaadeaaaecbaccdcdbecddebedcabbdceeaaebeebcbaadbbcbadccedabdbbeedbeaaddbdeadbbceeacbebacabcbeceedddedbbaddeabdeceeaaaacbccbcabeaeadbaaacaaadbeeabadeecdecbdeacaacdbcadbaebebcdebdeebecbdedaabdacddaabacedcddbdeddbbdcaecbabdeebeaebdbb...

output:

1145009288

result:

ok answer is '1145009288'

Test #16:

score: 0
Accepted
time: 20ms
memory: 116420kb

input:

214
azqbeguwsevbuncqaroqgazqbeguwsevazqbeguwsevbuncqaroqgazqbeguwsevbuncqaroqgazqbeguwsevazqbeguwsevbuncqaroqgazqbeguwsevazqbeguwsevbuncqaroqgazqbeguwsevbuncqaroqgazqbeguwsevazqbeguwsevbuncqaroqgazqbeguwsevbuncqaroqgazqbeguwsevazqbeguwsevbuncqaroqgazqbeguwsevazqbeguwsevbuncqaroqgazqbeguwsevbuncqaroq...

output:

1151326618

result:

ok answer is '1151326618'

Test #17:

score: 0
Accepted
time: 22ms
memory: 122512kb

input:

7224
ajwgyefdzbbjhvniphuajwgyefdzajwgyefdzbbjhvniphuajwgyefdzbbjhvniphuajwgyefdzajwgyefdzbbjhvniphuajwgyefdzajwgyefdzbbjhvniphuajwgyefdzbbjhvnip
aaswomqmzlgbmxjwjruuaaswomqmzlgaaswomqmzlgbmxjwjruuaaswomqmzlgbmxjwjruuaaswomqmzlgaaswomqmzlgbmxjwjruuaaswomqmzlgaaswomqmzlgbmxjwjruuaaswom
apcbdqgyhybfzap...

output:

39236949

result:

ok answer is '39236949'

Test #18:

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

input:

11278
alcrkrftlkbxzpcebwxxalcrkrftlkalcrkrftlkbxzpcebwxxalcrkrftlkbxzpcebwxxalcrkrftlkalcrkr
asfgdlqsovkbsnkasfgdlqsovkasfgdlqsovkbsnkasfgdlqsovkbsnkasfgdlqsovkasfgdlqsovkbsnkasfgdlq
aobfgcdvtuasaoaobfgcdvtuasaobfgcdvtuasaoaobfgcdvtuasaoaobfgcdvtuasaobfgcdvtuasaoaobfgcdv
auubvwtruncjauuauubvwtruncja...

output:

26413999

result:

ok answer is '26413999'

Test #19:

score: 0
Accepted
time: 19ms
memory: 117056kb

input:

33
apqjmltfbygopeezfapqjmltfapqjmltfbygopeezfapqjmltfbygopeezfapqjmltfapqjmltfbygopeezfapqjmltfapqjmltfbygopeezfapqjmltfbygopeezfapqjmltfapqjmltfbygopeezfapqjmltfbygopeezfapqjmltfapqjmltfbygopeezfapqjmltfapqjmltfbygopeezfapqjmltfbygopeezfapqjmltfapqjmltfbygopeezfapqjmltfapqjmltfbygopeezfapqjmltfbygo...

output:

7426319363

result:

ok answer is '7426319363'

Test #20:

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

input:

28
aechgbxrexqdgusaechgaechgbxrexqdgusaechgbxrexqdgusaechgaechgbxrexqdgusaechgaechgbxrexqdgusaechgbxrexqdgusaechgaechgbxrexqdgusaechgbxrexqdgusaechgaechgbxrexqdgusaechgaechgbxrexqdgusaechgbxrexqdgusaechgaechgbxrexqdgusaechgaechgbxrexqdgusaechgbxrexqdgusaechgaechgbxrexqdgusaechgbxrexqdgusaechgaechgbx...

output:

8721480282

result:

ok answer is '8721480282'

Test #21:

score: 0
Accepted
time: 84ms
memory: 174460kb

input:

1545
eacfddfabffdfdbbgbcdbgfbfbeccffdddgdagaaaccaaffcabcdcddabcdcdafacddcbbaeafcbbadaefbbbbfffaafgfbbcbeafdegdedbffaccaaffcabdcafgefbfabbggaccbabgggcaadbgcfeefgaceddaaceabdabeedgcebebcgaaceabdabebfcafdeaaacdcddabcdcgdacggedaacdcbfeabgfbageggacegbbggaccbabgebfegbecaefcgbbdgdafeefgacedddfcddfeggcfdege...

output:

316540941

result:

ok answer is '316540941'

Test #22:

score: 0
Accepted
time: 92ms
memory: 171404kb

input:

2916
gdebacaacfebadgdafeedgeadfaebagefffefbggdabcedfegaggdfagdfafdbbffgcfeaedebbbebegedefgeefcgaeccfebbgbedefgeefcgdddfdaedebcdggcggcddgcaecaeeabagabeebfgbaegcfcbaaaedefgeefcgbedbdbcadbdbbffgcfeabfbbadbaaaggdfagdfafeeecfaaeageebfcafedddddfdaedebadgbgdbgcaeebfcafeddffebfeeafdfadfefbadceefgcbabeaffefe...

output:

163900615

result:

ok answer is '163900615'

Test #23:

score: 0
Accepted
time: 71ms
memory: 176448kb

input:

616
fbcdedbfdgcffbcdeadgdbafecgccbbdgcgagcadaefbbdcbcbbdgcgagcadffgfgdgbefgggeadcfcbecefbdfebbfdgffegedbgeacecbeecgefcfaeaefbaddcbaebcbaddcbaebcdbedeedcfcfbdbcfaaeagceccdbbdcecefbdfebbffgfgdgbefbabbdabadfdegaecfgeccffbcdeadgfdgffegedbfbcdedbfdgdbecgdcdedfdgffegedbgceccdbbdcabeabdffbagceccdbbdcbdddaf...

output:

803953105

result:

ok answer is '803953105'

Test #24:

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

input:

487
aaaaaaaauouaaaaaaaauouaaaaaaaauouaaaaaaaauouaaaaaaaauouaaaaaaaauouaaaaaaaauouaaaaaaaauouhdnbkzzxpcaaaaaaaauouaaaaaaaauouaaaaaaaauouaaaaaaaauouaaaaaaaauouaaaaaaaauouaaaaaaaauouaaaaaaaauouhdnbkzzxpcaaaaaaaauouaaaaaaaauouaaaaaaaauouaaaaaaaauouaaaaaaaauouaaaaaaaauouaaaaaaaauouaaaaaaaauouhdnbkzzxpcaa...

output:

452762759

result:

ok answer is '452762759'

Test #25:

score: 0
Accepted
time: 31ms
memory: 118252kb

input:

3
aaaaaaaammgaaaaaaaammgaaaaaaaammgaaaaaaaammgaaaaaaaammgaaaaaaaammgaaaaaaaammgaaaaaaaammgaaaaaaaammgaaaaaaaammgaaaaaaaammgaaaaaaaammgaaaaaaaammgaaaaaaaammgaaaaaaaammgaaaaaaaammgqejhwqijvmqfrlaaaaaaaammgaaaaaaaammgaaaaaaaammgaaaaaaaammgaaaaaaaammgaaaaaaaammgaaaaaaaammgaaaaaaaammgaaaaaaaammgaaaaaaaam...

output:

56482697969

result:

ok answer is '56482697969'

Test #26:

score: 0
Accepted
time: 21ms
memory: 120772kb

input:

958
aaaaaaaaaaaaaaaaencfjaaaaaaaaaaaaaaaaencfjaaaaaaaaaaaaaaaaencfjaaaaaaaaaaaaaaaaencfjaaaaaaaaaaaaaaaaencfjaaaaaaaaaaaaaaaaencfjaaaaaaaaaaaaaaaaencfjaaaaaaaaaaaaaaaaencfjaaaaaaaaaaaaaaaaencfjaaaaaaaaaaaaaaaaencfjaaaaaaaaaaaaaaaaencfjaaaaaaaaaaaaaaaaencfjaaaaaaaaaaaaaaaaencfjaaaaaaaaaaaaaaaaencfjaa...

output:

224593548

result:

ok answer is '224593548'

Test #27:

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

input:

12095
aaaamfkaaaamfkaaaamfkaaaamfkaaaamfkaaaamfkaaaamfkaaaamfkciokmombaaaamfkaaaamfkaaa
aaaaaaaaaaaaaaaafligyaaaaaaaaaaaaaaaafligyaaaaaaaaaaaaaaaafligyaaaaaaaaaaaaaaaafligy
aaaaaaaafsmaaaaaaaafsmaaaaaaaafsmaaaaaaaafsmaaaaaaaafsmaaaaaaaafsmaaaaaaaafsmaaa
aaaaaaaamuvaaaaaaaamuvaaaaaaaamuvaaaaaaaamuvaa...

output:

15304035

result:

ok answer is '15304035'

Test #28:

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

input:

15357
aaaaaaaakcuaaaaaaaakcukkjnwaaaaaaaakcuaaaaaaaakcukkjnwaaaaaaaakcu
aaaaaaaaugiaaaaaaaaugiaaaaaaaaugiaaaaaaaaugiaaaaaaaaugiaaaaaaaaugia
aaaaaaaaaaaaaaaaonnpjaaaaaaaaaaaaaaaaonnpjaaaaaaaaaaaaaaaaonnpjaaaa
aaaaaaaaaaaaaaaaczacjaaaaaaaaaaaaaaaaczacjaaaaaaaaaaaaaaaaczac
aaaaaaaawwfaaaaaaaawwfaaaaaaa...

output:

12407081

result:

ok answer is '12407081'

Test #29:

score: 0
Accepted
time: 90ms
memory: 186144kb

input:

8821
hhhhhhghhhhghhhhhhhhhhhhhfhhhhhhhhhhhhhhhhghhghhhhhhhhhghfhghggghhhhghhghhhhhhhhhhhhhhhhfhhhhghggghghghhhhhghhhhhh
hhhhhhhhghhhhgghhhhhhhhgfhhhhghhhhhhhhghhhhhhhhhhfhghghhhheghhhhhghhhgghhghhhhhhhhhhhhhhhhghhhhhhghhhhhhhhhhehhhh
hghhhgghhhhhhhhhhhhehghhhhhhhfhhhgghhhhhhhghhhhhhhhghfhhhgghhffhgh...

output:

39996161

result:

ok answer is '39996161'

Test #30:

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

input:

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

output:

6002528

result:

ok answer is '6002528'

Test #31:

score: 0
Accepted
time: 95ms
memory: 176340kb

input:

12457
lkljlgkllljljklkllljlljljlllkllllllllllljllkllljllllkjkllllllkillkkllkjlkkllkl
llklklllkllilljjllklkljlkjlllkkllkllkkllllkkjjlklllllllkklllllkljllkljlilkllljklll
llklklllkhljjlljllljlljljlllllklllklkklllkllklllkllllllkljllllllllkkllllllllk
llllllkllljkllkjkllllkllllllklllkllikkkllkkglllllkllll...

output:

27420733

result:

ok answer is '27420733'

Test #32:

score: 0
Accepted
time: 110ms
memory: 174160kb

input:

13968
lkllllkjllllllkllljkjljkkllllkllklllklkllllllikllkllllllkillkklkklhk
llljlilklllkllllilkklllllkkllkjlkkllllllklkklljkklllkklkliljlkjllkllllj
lkkllkllkllklkkkjlllllkkkllklhkkklkjllllklllkljllllkklllljljllklkllllllll
lklllkllijlkjlllljllkkllllllllkklllkkllklllllllljllklllllljllhlllllllk
lljllklh...

output:

23006835

result:

ok answer is '23006835'

Test #33:

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

input:

1424
kllklkkllkklkllllllllllkllllljlkllilljlkkkklkllkllljlllljllljklllljkkliljllllklklllkklllllkllljlllklklklklklllllkjljkllllklllliklljlklllllkllllllllllklklllklllllklllllkjlklljjkllllllllllkllkllllllllklllljkllkljlklkljjlljlkkllkkllllkklllllklkllllllllllkllllllkklllllllllllkklkklllllllklkklkllkllk...

output:

336960929

result:

ok answer is '336960929'

Test #34:

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

input:

389
jllllllkljkjillljlllkkllljlklkkllkkllklkkjlllklkllkllllljlllkkklkklkllllllklklkllilklkllklllkjllkkllllkllklkkljkklllllklkjllllillllljkljlllkllljlkllllllkljklkklllllkljlklllklllkikkllkkjllkllilkllkljlllklkllllkkkllkklllllllllilllljilkllkllllllljlklllllllljjkllljllllkilljlkllllljjlkklkjllkllllllkl...

output:

1270722646

result:

ok answer is '1270722646'

Test #35:

score: 0
Accepted
time: 103ms
memory: 193772kb

input:

1
lljllillllkklllklkllllllllllkllkillllkllllklklklllllljkilllllkkkjlllllkllllkklkklllllelkljkklllljlllllllllljllkllljllllljlkkllkkkjllkllllklllllklklkhlllklllllllklljllllklllkllllkgjlkklllllkklllliljlllkkkllkklklllkkllkkjkllllljlkkllklllkjklkllkllklllljkjjlllllllllkljklklllklllilllklkllklllklkllllll...

output:

499986467945

result:

ok answer is '499986467945'

Test #36:

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

input:

557
lllllllllkllkllkkllllllkhlkkjllllkllklkllllkjllkklljlklljllllllljkllliklllilkkjllkllllljllljlllkjlljjjklllllljkkkklljllljlllljjllljllljlllllllllllllkllklflllllljklllllkllljkllljklkklkjllllllkklllllkikllillkllijlllkkllllljlljljjkllllkllllllllllkllkljlllllillllllllllkillkjljklkllillklllllkljllllll...

output:

883262766

result:

ok answer is '883262766'

Test #37:

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

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: 57ms
memory: 121060kb

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: 71ms
memory: 152576kb

input:

3628
aaaaaaaacmyaaaaaaaacmyaaaaaaaacmyaaaaaaaacmywwwyyneaaaaaaaacmyaaaaaaaacmyaaaaaaaacmyaaaaaaaacmywwwyyneaaaaaaaacmyaaaaaaaacmyaaaaaaaacmyaaaaaaaacmywwwyyneaaaaaaaacmyaaaaaaaacmyaaaaaaaacmyaaaaaaaacmywwwyynevwnjssfgatjkuxyaaaaaaaacmyaaaaaaaacmyaaaaaaaacmyaaaaaaaacmywwwyyneaaaaaa
aakmaakmaakmaakmaa...

output:

103987512

result:

ok answer is '103987512'

Test #40:

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

input:

12813
aaaaaaaaaaaaaaaaiddesaaaaaaaaaaaaaaaaiddesaaaaaaaaaaaaaaaaiddesaaaaaaaaaaaa
aaaaaaaawsoaaaaaaaawsoaaaaaaaawsoaaaaaaaawsoaaaaaaaawsoaaaaaaaawsoaaaaaaaawsoa
asecbauzasecasecbauzasecbauzasecasecbauzasecasecbauzasecbauzasecasecbauzasecbauz
daahekajbnookaegclmcggkffpmcopnmjclpmlgildkmgclpnkgpgpclen...

output:

26912166

result:

ok answer is '26912166'

Test #41:

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

input:

2
gdcfddceadedgcfgdgcagafbdabdcefcabcafcdggfgfddefdgcfgaebbbbdceggcbddfbgaeggadfbcgafbdabdceeadegegcggedffcccbbecafdgdfdbfgafbdabdcegcbdecdffdccaeecfgecbdaafddccfcaadgagedccfceadabfeegcdeccdaccaadgagedcabafgfcgggedffcccbbecafdgdfdbfdfegccdggcdgfdccgabefbcbacadfafcabcafcdgcfceadabfeceggcbddfbgdcfddce...

output:

249980713640

result:

ok answer is '249980713640'

Test #42:

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

input:

6
llklklllllllllkljkkllljllklikkikjilllljlllkkilllllklllljllklllkjlillljilllkllllilllljlkllllklllljklllklkkkllllklklllllllllllklllllillkkhljkllliiklllllklllkllllljlllllljlkllllkllllelljlkljllllllllllklkjlllkljllllilllklkkkflllkllkllkkllllllllklllilklljlklljlllllkljjjlkllljljlilllllklklkklljkljllilkl...

output:

75007300766

result:

ok answer is '75007300766'

Test #43:

score: 0
Accepted
time: 64ms
memory: 149504kb

input:

11005
illllkkllllllljlllllkljlklkllllklllllklkllllllkklllklkllklllklllllkklllkllljlllhljjllklllll
lllklkljllkillklkljlllklllllllllljlljkllllklklklllllllllklllljkljlllllllklkkjllllllllijllll
lllljllkklkkillllllkllllllklklkkjlllllklllllllljlllllkllklllkllillllkiljlkllklkkjklllkkk
aaaaaaaaqzzaaaaaaaaqz...

output:

31075980

result:

ok answer is '31075980'

Test #44:

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

input:

168
edfdgadafegedbfbeefccfebdfebfdbfgcadbbecedfdgadafedfdeegdgbabebefdccdfbgegcaggacfacccabbggcacdbfcccbdfgbadeffabcbafcedggffdbgagfbdfdcfccagggdafeedfebdcdfcggdgdcgbgfcaefeddcecggbefccacdbfcccbfcfcdccbdcbeafdeefeddfdeegdgbabfgcadbbecaaeacdcdaaefffedgdedfcfgcedabbfffdaeecadbcbafcedggbgbaaccdfdbgegca...

output:

2221581860

result:

ok answer is '2221581860'

Test #45:

score: 0
Accepted
time: 47ms
memory: 159160kb

input:

34
lkllllllllilljkllllllkkjllllllllkiljkklkklklllllkkllllkllkljgllkliklllkllkllllllklllljlklllllklllllllljlijklklllkkklkjlllllklllllljllklllljlkllklllljllejlllllllllklllklllkljklljikjllllllllljllljllkklllllllllllllllkllllkllllllhljlllljlllkllkllkllllklllkillkkljlljlklllkljkllllljklllllljllllkkklllll...

output:

11609354185

result:

ok answer is '11609354185'

Test #46:

score: 0
Accepted
time: 72ms
memory: 152864kb

input:

1093
lllllllllllkjllllklkklllkkljllllkkjlklllllkkllllklllkllllllkllkllllklkllkkjlljlllkklllliklkiljklilljllljlllhlkklklllllkllkljililllkllklllllkllklllllljlllllkllkllllljlllllllklllkklkllllkllllllklllkllllhkkllljllkllllkkllkljlllllllllkkllllllklllkllkllllilkllljlllllljjlljjklkklklkjlljkllllllllkllll...

output:

354111743

result:

ok answer is '354111743'

Test #47:

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

input:

71
jlkllkklllllkkklilkllkllllllllllklllljllllljkklllllllllhllllkkkllkjkllllllhlllillllllkkllllhlklllllllllkkllkkkjlkklkllllllkjlclkjllllklkllkljlkllklkljkllllllllljlhlkllllkilklllkjllljljlkllllkklklllllllklllklkkjllkkklllhjlllllllkklllllkllkllllllkklfkljllklllljllkllllkllkkljllkklljlllllllllikllkkll...

output:

5329897030

result:

ok answer is '5329897030'

Test #48:

score: 0
Accepted
time: 74ms
memory: 152360kb

input:

308
jcicgcibjfhcedjjbefddaafdcfdjeadeefgcfhjjbjgdhcgjigdaaefjdcdgjdaagggbjbbjgjbcaijedaccgieedfahebheabcceijcaecabidjajijedfjaaggcghdjibjjicbhjafcdhigcbgeaedehajbcfhhadefcgibjigfiggiibghcjiabjajggcjgbabfbbdaeadhabheahfbhjbchbehiighabdcgaicfjiechaeddeaeejicifigdeaeicdieabefijcbffbfhhbijgiciihgcdeghac...

output:

1245588935

result:

ok answer is '1245588935'

Test #49:

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

input:

396
aaaaaaaawlkaaaaaaaawlkaaaaaaaawlkaaaaaaaawlkaaaaaaaawlkaaaaaaaawlkaaaaaaaawlkaaaaaaaawlkiwtpadegjxaaaaaaaawlkaaaaaaaawlkaaaaaaaawlkaaaaaaaawlkaaaaaaaawlkaaaaaaaawlkaaaaaaaawlkaaaaaaaawlkiwtpadegjxaaaaaaaawlkaaaaaaaawlkaaaaaaaawlkaaaaaaaawlkaaaaaaaawlkaaaaaaaawlkaaaaaaaawlkaaaaaaaawlkiwtpadegjxaa...

output:

992295088

result:

ok answer is '992295088'

Test #50:

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

input:

2312
abvfbqfgqbpllvmiabvfbqfgqabvfbqfgqbpllvmiabvfbqfgqbpllvmiabvfbqfgqabvfbqfgqbpllvmiabvfbqfgqabvfbqfgqbpllvmiabvfbqfgqbpllvmiabvfbqfgqabvfbqfgqbpllvmiabvfbqfgqbpllvmiabvfbqfgqabvfbqfgqbpllvmiabvfbqfgqabvfbqfgqbpllvmiabvfbqfgqbpllvmiabvfbqfgqabvfbqfgqbpllvmiabvfbqfgqabvfbqfgqbpllvmiabvfbqfgqbpllvm...

output:

163513482

result:

ok answer is '163513482'