QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#463657 | #7994. 勿蹖宠物 | C1942huangjiaxu | TL | 1268ms | 8260kb | C++14 | 1.3kb | 2024-07-05 10:36:44 | 2024-07-05 10:36:44 |
Judging History
answer
#include<bits/stdc++.h>
using namespace std;
const int N=605,P=1e9+7;
int n,L,m,ln[N],p[N][N],f[N][N],g[N][N],ans,c1;
pair<int,int>pos[N];
char s[N][N];
inline void Add(int &x,int y){
if((x+=y)>=P)x-=P;
}
int main(){
scanf("%d%d",&n,&L);
for(int i=1;i<=n;++i){
scanf("%s",s[i]+1);
ln[i]=strlen(s[i]+1);
if(ln[i]==1)++c1;
for(int j=1;j<=ln[i];++j)pos[++m]={i,j},p[i][j]=m;
}
f[0][0]=1;
for(int t=0;t<L/2;++t){
for(int i=0;i<=m;++i)for(int j=0;j<=m;++j)if(f[i][j]){
int w=f[i][j];
f[i][j]=0;
vector<pair<int,int> >vk,vl;
if(i)vk.emplace_back(pos[i].first,pos[i].second+1);
else for(int k=1;k<=n;++k)vk.emplace_back(k,1);
if(j)vl.emplace_back(pos[j].first,pos[j].second-1);
else for(int l=1;l<=n;++l)vl.emplace_back(l,ln[l]);
for(auto [ik,jk]:vk)for(auto [il,jl]:vl)if(s[ik][jk]==s[il][jl])
Add(g[jk==ln[ik]?0:p[ik][jk]][jl==1?0:p[il][jl]],w);
}
swap(f,g);
}
for(int i=0;i<=m;++i)for(int j=0;j<=m;++j)if(f[i][j]){
int a,b,c,d;
tie(a,b)=pos[i],tie(c,d)=pos[j];
if(!i){
if(!j){
if(!(L&1))Add(ans,f[i][j]);
else Add(ans,1ll*c1*f[i][j]%P);
}else if(d==(L&1)+1)Add(ans,f[i][j]);
}else{
if(!j){
if(b+(L&1)==ln[a])Add(ans,f[i][j]);
}else if(a==c&&b+1+(L&1)==d)Add(ans,f[i][j]);
}
}
printf("%d\n",ans);
return 0;
}
詳細信息
Test #1:
score: 100
Accepted
time: 2ms
memory: 6984kb
input:
7 9 cats eel eve evil lee olive stack
output:
5
result:
ok single line: '5'
Test #2:
score: 0
Accepted
time: 0ms
memory: 7852kb
input:
2 2 a aa
output:
2
result:
ok single line: '2'
Test #3:
score: 0
Accepted
time: 3ms
memory: 6976kb
input:
6 12 aa aab no on pets step
output:
43
result:
ok single line: '43'
Test #4:
score: 0
Accepted
time: 122ms
memory: 6908kb
input:
26 1000 a b c d e f g h i j k l m n o p q r s t u v w x y z
output:
710955506
result:
ok single line: '710955506'
Test #5:
score: 0
Accepted
time: 10ms
memory: 6928kb
input:
33 18 zrkodfkhhkfdokrzo ytcbwrgyygrwbcty makgiybggbyigkamc aptmvovgccgvovmtpa yydxdzhhhhzdxdyy iadqfexoxacojythvk iagcfiwlaalwifcgai rtfzhddzzddhzftrm vkreigbdyxfiuvyqid mbcgnvrvvrvngcbmc lywbtspuyyupstbwyl bmjxalsyyslaxjmb jrbminaooanimbrj wwrajerkkrejarww grocaiqccqiacorg efvibgurrugbivfec ilyzrft...
output:
9
result:
ok single line: '9'
Test #6:
score: 0
Accepted
time: 10ms
memory: 7876kb
input:
33 18 babbababbbbababbab abbabaabaabaababba aaabbbaabbaabbbaaa aaabaababbabaabaaa ababbaabbbbaabbaba baababbbbbbbbabaab aababbbaaaabbbabaa bbbbbabaaaababbbbb aabbbaaaaaaaabbbaa aabbbabaaaababbbaa bbabbaabaabaabbabb aababbabbbbabbabaa baaaaaabbbbaaaaaab aaabababaabababaaa bbaabbaaaaaabbaabb bbbababab...
output:
33
result:
ok single line: '33'
Test #7:
score: 0
Accepted
time: 3ms
memory: 6832kb
input:
33 18 babababaaaabababa abbbabbaaaabbabbba bbaaaabbaabbaaaabb baabbbbaaaabbbbaab abbbaababbabaabbb aaababbabbabbabaaa abbbbbbabbabbbbbba bbaabaaaaaaaabaabb aaaaabaaaaaabaaaaa abbbaabbbbbbaabbba abbbbaaaaaaaabbbba bbbbbbbbaabbbbbbbb baabaabbbbaabaab bbaababaaaababaabb baaabaabbbbaabaaab bbaaaabbbbbba...
output:
27
result:
ok single line: '27'
Test #8:
score: 0
Accepted
time: 6ms
memory: 7360kb
input:
33 18 bbbababaabababbb abaabaaabbaaabaaba aaabbbbbbaaaabbbab aaabbababbababbaaa abbaaabaabaaaaabbb abababaaaaaabababa bbabaaaaaaaababb bababbaaaaaabbaba aaaaababbbbabaaaa aaabaababbabaabaa abbbbbabbabbbbbaa abbbbbaabbaabbbbba abaaabbabaabbbabbb aabaabbbaabbbaabaa aaababbbbbabababaa abaaabbaabbaaabab...
output:
8
result:
ok single line: '8'
Test #9:
score: 0
Accepted
time: 799ms
memory: 7264kb
input:
199 999 lbl buei ieub uw wu impv vpmi yrek kery cw wc hjs sjh bct tcb up pu wh hw ftn ntf iv vi ejpj jpje qjgh hgjq kvny ynvk xo ox pr rp sdh hds go og qw wq bgt tgb czwk kwzc coqr rqoc af fa ms sm gs sg hnz znh rugm mgur lak kal xlv vlx na an fdoe eodf oixg gxio mb bm bjt tjb bto otb oxq qxo tg gt ...
output:
810133722
result:
ok single line: '810133722'
Test #10:
score: 0
Accepted
time: 808ms
memory: 7956kb
input:
198 999 eme hm mh msi ism ig gi kmm mmk nkxq qxkn uv vu mgj jgm zyap payz xz zx oi io spe eps kr rk pqp pvyw wyvp pk kp nrin nirn ehj jhe vb bv fnzq qznf lem mel lxek kexl sy ys smcs scms xaq qax zdsn nsdz pudp pdup zt tz op po oe eo cea aec df fd om mo zr rz wabq qbaw ehde edhe cq qc utd dtu rj jr ...
output:
165733504
result:
ok single line: '165733504'
Test #11:
score: 0
Accepted
time: 1259ms
memory: 7508kb
input:
187 999 dcd ede bbb ga ag aead daea ec ce bf fb ffg gff bde edb efc cfe bb aged dega cea aec accg gcca cge egc gb bg cfcg gcfc fgg ggf bffc cffb fg gf bac cab adfb bfda ff adfe efda ggaf fagg age ega cb bc acbd dbca bbdd ddbb ee fegg ggef gca acg ffab baff gdb bdg gee eeg babb bbab bfe efb be eb ddb...
output:
359867349
result:
ok single line: '359867349'
Test #12:
score: 0
Accepted
time: 1262ms
memory: 7184kb
input:
189 999 beb dfd fbf bcb fef aaa gdg eg ge ebc cbe eaf fae bf fb daa aad caec ceac df fd eca ace gdge egdg adfb bfda dda add bcdc cdcb ed de ggaa aagg bge egb fgf efd dfe acbb bbca ac ca bg gb dbge egbd da ad gbf fbg ccae eacc eaa aae cea aec gc cg feg gef eebg gbee ccga agcc ag ga aa bb gdf fdg bagd...
output:
559580115
result:
ok single line: '559580115'
Test #13:
score: 0
Accepted
time: 835ms
memory: 7196kb
input:
201 1000 cni inc shxg gxhs xfpi ipfx ymt tmy sx xs bqe eqb mwg gwm mb bm lbtj jtbl dx xd srra arrs gmyd dymg ot to zrv vrz eojb bjoe he eh fq qf vrc crv wdev vedw ey ye nrh hrn kuee eeuk syy yys xw wx hjrn nrjh btyx xytb cdop podc uj ju il li kief feik ao oa hhfc cfhh ev ve jbs sbj plle ellp iz zi q...
output:
56283946
result:
ok single line: '56283946'
Test #14:
score: 0
Accepted
time: 811ms
memory: 7252kb
input:
195 1000 fz zf qry yrq yypc cpyy bvx xvb gwd dwg iois sioi uw wu lvvh hvvl tp pt xbzk kzbx mdqo oqdm ism msi io oi ab ba qv vq eq qe wz zw pgz zgp as sa goj jog jcqe eqcj fv vf vr rv uozz zzou xcf fcx zm mz xnu unx sx xs ju uj ess sse sjvx xvjs ocvv vvco jvc cvj jtv vtj pobl lbop kgl lgk hf fh dxqh ...
output:
355466754
result:
ok single line: '355466754'
Test #15:
score: 0
Accepted
time: 8ms
memory: 7300kb
input:
40 15 occjsczezcsjcco odjqcujujucqjdo ckxmwkxxxkwmxkc cengyrspsrygnec mustbeqxqebtsum ojybscqgqcsbyjo jtdxwojojowxdtj jocjsdcecdsjcoj ugfdekcyckedfgu wstuseufuesutsw ygzvluajaulvzgy tbttlibvbilttbt curoimqsqmioruc zmnfwmdxdmwfnmz addnzxieixzndda mzhrceznzecrhzm viprlgbsbglrpiv agghkwooowkhgga waudmb...
output:
40
result:
ok single line: '40'
Test #16:
score: 0
Accepted
time: 1248ms
memory: 7272kb
input:
181 1000 aecd dcea dgdg gdgd bg gb bea aeb aafd dfaa cegb bgec cbge egbc ggdd ddgg dbab babd eaca acae faf ef fe efea aefe feg gef eag gae cgd dgc fb bf egeb bege gcbf fbcg ffbc cbff fee eef cgg ggc dcd cbga agbc fa af fg gf badd ddab egf fge gffc cffg fdcg gcdf cdf fdc aceb beca dcgc cgcd aa becg g...
output:
550526203
result:
ok single line: '550526203'
Test #17:
score: 0
Accepted
time: 1268ms
memory: 7280kb
input:
188 1000 gaac caag fb bf efad dafe fadg gdaf be eb bfd dfb fdfa afdf cdg gdc gfa afg agb bga fde edf faf ege fccc cccf bdd ddb ce ec gcd dcg gdgf fgdg bae eab ag ga db bd dfe efd aacd dcaa cgaf fagc dgcd dcgd agef fega dcd ge eg dgfd dfgd daaf faad acb bca cf fc fd df ea ae fdfg gfdf dfg gfd bg gb b...
output:
324658912
result:
ok single line: '324658912'
Test #18:
score: 0
Accepted
time: 943ms
memory: 7636kb
input:
158 999 iu cziz uyu clxkxlc s ll jjam kzonoz tydbdy g deffe c massam y cyc mvm xssx ege dhjdjhd d wcwix rr cjppjc icttci lzl rwrp vv dklhlkd uku f k sd u zkkxkkz r evjqjv q lpuplz kirgrik gj zqwq svzzvs kjjkc mu qvvq gtqtg mqmc p cvscsvc mymkz kkb v nd sxxs zxcxz l uppu ibnbi ynywyny ldtdl uzzu h ix...
output:
651380718
result:
ok single line: '651380718'
Test #19:
score: 0
Accepted
time: 901ms
memory: 7128kb
input:
152 999 kk d ww fbf qckakcq a p xxz jh ji kook npp fohof ddopod zddzr vkppkv fscsf rbrr hssh ezzev z addda smsw qq o rddr coc izz m n paffa syzzys toot q zzaazz eeh bkk wqqeqqw zfzc lcycycl vv j iccic nnfnni sfkkf u f yhqqh oyy rnxxnr c xennex ijpji kdk nno lxppx lyl v ucecu qzqp y cllc e eaeea ogmm...
output:
747844933
result:
ok single line: '747844933'
Test #20:
score: 0
Accepted
time: 1239ms
memory: 7924kb
input:
146 999 fcbcfc f beeee ee ada cbce d dgagd dfd e ef bb ebbb a dd cdagadc c cagac fgfg fdfg dfefd eec aea dfddfd cg fccf bcegecb cbbce afefa affad cbgbcg adbda g b cc aaa ggbgg ff dbdbd bcbeb ffddff eddgdd ccbb bbf affa geeg egeg eaae ggfafgg fdedf efgegfe dcd abbag bbefeb eaddae eegee eee ebbec bbb ...
output:
282812880
result:
ok single line: '282812880'
Test #21:
score: 0
Accepted
time: 1201ms
memory: 7536kb
input:
138 999 aecbcea c ceebeec afddfa b bbbc ff gb cc ceeee aa f d db dfd agaga cgc gcfafcg ggaagg a ecddce cefffec acbbca dfdfd fabaf baaab gcegecg eged fgbbg dcbbcd gbddb e dbdea beeb bdcdb g bbbb cbggbc fdaadf dbaabd gfgegfg bffffb bbdddbb adeda cf bcc ccccc ba dcde cbb bdb cdc fef cffc ce gbbbg geeg ...
output:
440062152
result:
ok single line: '440062152'
Test #22:
score: 0
Accepted
time: 864ms
memory: 7428kb
input:
157 1000 fttf pzp bpgrgpb r hch niin gng zrwwrz vqbbqv ghrvrh xrxf nkkn c m wz phhp jgaagj ufs jhhj uqqu bb d sdxlxd itti aa ihjojh q ma l dd fsksf cilicd s hmym z lorrol yya vgvv e frgrf gg runnur h lq f vavgf jqlqj kk jj pfzxzfp vv ff p w fzbbzf ylkzkly cddc dwaaw mi llxq ppp tgdgt rdidr oo g uxjt...
output:
763797775
result:
ok single line: '763797775'
Test #23:
score: 0
Accepted
time: 957ms
memory: 7808kb
input:
161 1000 ipvpi t a cbf n xqx g lmyyml mvm lww iki jsjn vvu okko waeea k ucnencu bb icwqwci xerexu qvvq z eqq q ooo qndn dmmmd hguugh tuut nww hii pr jjjj tncn zykk doodp yrwwry soqos ymy paa d zvwvwvz o yf gnhhng mmo v ee c yvuuvy i auhihu e qc wppw slobol eqxqe yuuy h wkckwp qv czbbzc dnmndq oc qfq...
output:
535630694
result:
ok single line: '535630694'
Test #24:
score: 0
Accepted
time: 1232ms
memory: 7964kb
input:
148 1000 bababa eagga b ggaagg faaf bccb aggg d feff befe dfbfdd f deeee adcccda bebebe aa ea dfcfd g gaag dgaagd gddga ecgcea aaec dgggg ebcbe dabadc ge efcgcf dfdcdfd gga bg gdddg a gcfcg caaaac cagga eg edggde dcd ded cccc dadad gf egge dd fabba e edede c cgc dgfbfgd adda eacecae affa ff dbb ede ...
output:
966096873
result:
ok single line: '966096873'
Test #25:
score: 0
Accepted
time: 1226ms
memory: 7332kb
input:
151 1000 fe aebeae ebdbe gfgfge aa eeceef cfeef cbbc cgbbg g ddffdd gbg dgdgd ce dd feef e gcg fgf ffc ded edde eaaed egg gga cgag aebb bffb aea faaf b a bdb dbbd c beeeb cg fddfe bfaaaf be faa ffggf agae d bd aac ggggga ggg deded cecce f adcd fbggbf gfg ged ec ddg ceec bgaagb adbbda cccc daa caddac...
output:
889599153
result:
ok single line: '889599153'
Test #26:
score: 0
Accepted
time: 8ms
memory: 6924kb
input:
40 15 nvjptihahitpjvn ylhltkisiktlhly hhgkxxayaxxkghh weiyqmgrgmqyiew idjkgseqesgkjdi svfbkelylekbfvs ojnyywsxswyynjo dlwvzhjljhzvwld nbqraeiaiearqbn nzeponsdsnopezn iegnwhjhwngeii tepagywswygapet iiyvgxhkhxgvyii vhvrepjpjpervhv wdtbjfqyqfjbtdw xjpzmgikigmzpjx ameyshumuhsyema wvrmmfobofmmrvw gknqomr...
output:
37
result:
ok single line: '37'
Test #27:
score: 0
Accepted
time: 23ms
memory: 6824kb
input:
50 45 uzxejdyfgkulynhvxycenuiunecyxvhnyluk gfydjexzu mwdd vou xxfu hfgwuc krozelezorkc uwgfhufxx uovddwm m lcyweunncuqshzfiwtrpmpmprtwifzhsqucnnuewyclm ckbzz iaazn ahksaebkxqrxexrq x k beaskhanzaaizzbkc vhxflf qrxlypdonwylboacocaoblywnodpylxrqflfxhv vfkylx snvkncftnop rxjzsmszjxrpontfcnkv nsxlyk fv ...
output:
805191073
result:
ok single line: '805191073'
Test #28:
score: 0
Accepted
time: 23ms
memory: 7068kb
input:
50 45 fzkqwmtntvuqjmpcaodqqzjzqqdoac pmjquvtntmwqkzf ywzd l wfswkvyozpgvchj voqovjhcvgpzoyvkwsf w ldzwy gwjuggqiqmbsvzaiyrpyanxnaypryiazvsbmqiqggujwg abrmsbvhzqox wruvcel dyx i xydlecvurwxoqzhvbsmrb a qlgxfachtgy k tp pymy smhcxchmsymypptky gthcafxglq psfulkvythpihwzqwloollplloolwq zwhipht yvkluf sp...
output:
645330232
result:
ok single line: '645330232'
Test #29:
score: 0
Accepted
time: 27ms
memory: 6964kb
input:
100 45 mkd eljh nlsjioclutgyn mdfdmnygt ulcoijsln hjled km u gfvbz q g fbsbua rrewylyoeoyly werraubsbfgqzb vfgu cavceh ejn qzm ygm qedawmfdfmwade qmgymz qn jehecva c rlrv uqzklocepkdcvsbeot wtoebsv cdk pecol k zquvrlr lmug lfqn vi chnwx ggke pjxixjpek ggxwnhcivnq f lg uml ehvzyqna qmezoeef hldhj fxf...
output:
198598295
result:
ok single line: '198598295'
Test #30:
score: 0
Accepted
time: 29ms
memory: 7364kb
input:
100 45 hwyoltqyq lnbx jmfmjr bmuvumbrjmfmjxb nlqyqtloywh i xt njv zrnugikk tdeyrd kw ewkdryedtk kigunrzvjntxi rl tpiyrxyv umxaindpf b lbbblbfpdni axm u vyxr yip t lr w sflbbb hyvfn vwkrrbcumtgtmucbrrk wvnfvyhbbblf sw nrmg oiwr lbmsefscwujvdejedvjuwcsfesmbl rwiogm rn ltrjdbkkuba axforrhwlblplblwhrrof...
output:
262104358
result:
ok single line: '262104358'
Test #31:
score: 0
Accepted
time: 29ms
memory: 7480kb
input:
120 45 ol vpyxugloemtludupxh mfnfmhx pudult meolgu xyp vlo wnfoub rtzby bqds xzndztziztzdn zxsdq by bztr b uofnw tbutr elu inlzyotynnxicjf jcixnn yto yz lniulert ubt sp wbosgt tnjtj ve ydkntuqcqutnkdy evjt jnttgsobwps v fppdp gwuv bbjiblm db gwxh xwgbdmlbijb bvuwgpd pp fv hyr vtpfi agxijv zgjgffkugu...
output:
973659104
result:
ok single line: '973659104'
Test #32:
score: 0
Accepted
time: 27ms
memory: 7320kb
input:
120 45 enttq c dh zcwkeadj ahy ulv dvluyhajdaekwczhdcqt tne lbafc ap ay ptjwdawnfkwspj pswkf n wadw jtpyap acfabl phokcguir uckxmfj ur z derkr e dz rujfm xkcuriugcko h p ziw ybbzggz zmba gstwpehggg hepwtsgabmz zgg zbb y wiz nw qwtkg j qjdnxcie jfugbjpjbg u fje i cxndj qjg k twqwn wxvxcz tn iw bij he...
output:
402382805
result:
ok single line: '402382805'
Test #33:
score: 0
Accepted
time: 21ms
memory: 7112kb
input:
50 45 ce gggagdgbab cccfg aggbbfbbggagfc ccbabg dgagg gec gaaa fggaeb gcacdfddg fbgagbfgd d fdcacgbeaggfaa a g fe dbce fcaddaecdeaagegbc bgegaaedceaddacfe cbdef gbfcfbd egbeaeffbbbaggdcdggabbbffe aebgedbfcfbg cceccdecbebedbdddgbcdfefdcbgdddbdebebc edcce cc gdfcbdbe cbgfcbecdafcggfggcfadcebcfgbcebdb ...
output:
706185447
result:
ok single line: '706185447'
Test #34:
score: 0
Accepted
time: 25ms
memory: 6820kb
input:
50 45 ccegffdgfab agadeggg fa edeafgggeda gabafgdffg ecc dagcgaceabg a bbdcegae bcccbeagecdbbagb aecagcgad efgdceffgbege bf befdgacbcagdfeb fbegebgffecdgfe cebfbgddbgcbbgffdgbgfcecfgbgdffgbbcgbddgbfbec fecfagfcf gcbfbaa ab afabcbafaba aabfbcgfcfgafcef fgeff ddfbbaabcbfdcfacdcdcafcdfbc baabbf ddffegf...
output:
305248114
result:
ok single line: '305248114'
Test #35:
score: 0
Accepted
time: 35ms
memory: 6920kb
input:
100 45 fdfac eeabfbgcdgbdb b abd fdbabbdb gdcgbfbaeec afdf aad db fffadfbgadfdagda eeeadgad fd agb fdafffbddaa baagb age ba fefdfdgfgedfcfdegfgdfdfefabegab gaab aabc dggfb acfc bebdafge gfgegf adbe bcfc abf ggdcbaa a ebecba ecbd bcgecga dffedeffd agcegcbdbceabcebea ageabdd acff ebafc cadgga fa ggd a...
output:
174507622
result:
ok single line: '174507622'
Test #36:
score: 0
Accepted
time: 34ms
memory: 7008kb
input:
100 45 abaedccgbceg eabccaac bfdfbcaacc bae ge c bgccde aba effgbgeafcggfbdb gegcfbgbfcge gbdbfggcfaegb gffe fb deac ddfbbfbadda eeb db gbdb eeaddabfbbf d dcaedbf ffbc faebaeebdda adg e fdbg bdfegd a add beeabeafcbf f bgeggbegfgfeadgbag ag bbebbgagabgdaef gf gebggegb eefdfedgcabgfacebdbdgd ddgdbdbec...
output:
666843253
result:
ok single line: '666843253'
Test #37:
score: 0
Accepted
time: 7ms
memory: 7936kb
input:
40 15 ljmpoadaopmjlo flqdsizxzisdqlf gflzbobkbobzlfg jzudxxpxxduzjp ljgwvedwdzynscb aipjiefzfeijpia hbstmixzlipivku zdhrdeeneedrhd kvbhkcjzjckhbvk qcuuliawgfvdjva bwsvcarfracvswb mtoudiiuiiduotm rngwkxlxkwgnr yyjokfafkojyy vnxdvncgcnvdxn hgghcsfschgghk gomenqlylqnemog hraxglguglgxarh aamaajefejaama ...
output:
15
result:
ok single line: '15'
Test #38:
score: 0
Accepted
time: 44ms
memory: 7972kb
input:
120 45 abd eaeecba d eecfb ecebfda dfbecebfc ee dabceea e db a bc gfcgcb ggbfaf cfggfc gbb b gcfg gfc fafbggbcgcfgcb gdf dfafcaa egecadbae dbg dgbdea bda c egeaacf afdfdg gb efebb gdbafcbg fdg cac fc fca cgdf gbcfab dgbbe feb g ba daecaag dcdfde ebfcgaa eaa gcfbee df dcdgaa ceadab edggbgbc dd eae ed...
output:
111550963
result:
ok single line: '111550963'
Test #39:
score: 0
Accepted
time: 44ms
memory: 8120kb
input:
120 45 gc cf gdb edcebddebgd c gbdedbgcdgbeddbe cdebd gfccg dfabe acdafed bdccbfafa babaf afb ccd bde fa d caebafd fgafaaecef agae a efdfg aafaagfdfeaeagafeceaafagf gab gd eef ac bgae bad dec egage ced da beagbcafeedgbag gffbefb dba cdgd dde fbaf cd cfab fe dddgd cabdb febffg b ecf fde dggc g bcfa e...
output:
965367719
result:
ok single line: '965367719'
Test #40:
score: 0
Accepted
time: 22ms
memory: 7116kb
input:
50 50 osa hmsc fkiiyzxj enip meillhhlliempinejxzyiikfcsmhaso xvosqxctdoabhkkxp ejpjffibbiffjpjepxkkhbaodtcxqsovx bbdjp mmwtjwoxxnkormzaxaottoaxazmroknxxowjtwmmpjdbb cimbnmggaqmqop ksduxqtzkqhhqkztqx udskpoqmqaggmnbmic ubrwzaxawvnjuhmphrvdg wjoyyoj wgd vrhpmhujnv wax azwrbu szcyfpbxysafpeqsoxpwipuiee...
output:
35139630
result:
ok single line: '35139630'
Test #41:
score: 0
Accepted
time: 23ms
memory: 7712kb
input:
50 50 xquvoqdecfnepfj uqpih bselkklesbhipqujfpenfcedqovuq x jlrsnhsf sfzupzdqgwkxjpoewweopjxkwgqdzpuzfsfsh nsrlj xlnynpe xltm zbs bzohtzeyhlb blhye zth ozbsbzmtlxepnynlx skzhsuosqkzfwfbkwl spsjnvbbvnjspsl wkbfwfzkqsoushzks cjekubbgasys fhcjrhruyjipggpijyurhrjch fsys agbbukejc g sgtuv ahcpxnsbudou vm...
output:
39334022
result:
ok single line: '39334022'
Test #42:
score: 0
Accepted
time: 33ms
memory: 7376kb
input:
100 50 qulvb yncjxclkcbylqq exfca k kac f xeqqlybck l cxjcn yb vl uq xjcpwgjnzffl stusttfpvtbqnnqbt vpfttsuts lff znj gwpc jx hav xaxirfddbjbfs awoshlojnn jolhs owasfb jb ddfrixaxvah ilvnaqjcgfxvlmndokvqh musq qsum h q vkodnmlvxfgcjq anv li hmtjnuyafixlsezp sdgspl vpllpv lpsgd spzeslxi fayun jtmh nw...
output:
725990680
result:
ok single line: '725990680'
Test #43:
score: 0
Accepted
time: 32ms
memory: 6968kb
input:
100 50 thxsurhfogodpf hhnga pi mapnnp amipagnhhfpd ogofhrusxht clekprbhbstyyl qv xzsc onhxvvxhno cszxvqlyytsbhbrp kelc xoipphi uk nbbkr sre x atxr vniinvrxtaxersrkb bn kuihppiox of mwqlv thwsr urhr jo juborfjjfrobujojrhru rsw htvlqwmfo murzbp milpcteppjgyzurjb appab jruz yg jppetcplimpbzrum tatldlit...
output:
85098510
result:
ok single line: '85098510'
Test #44:
score: 0
Accepted
time: 37ms
memory: 7060kb
input:
120 50 ybyftyzztcerkuqluqmzkuptnntpukzmqulqukrectzzyt fyby eg xo haslhllszeu z cg dvlia bxxbailvdgczu ezsll hlsahoxge eowkuehjifnuj cy apwa sp hlmq qm lhpsawpay cjunf ijh e ukwoe rre mtqz zxwoqykaqzenoxa ry gg yraxon ez q a k yq ow xz zqtmerr uneybihemefxblqqqbt qtsy eddeys tq t bqq qlbx femehibye n...
output:
579174037
result:
ok single line: '579174037'
Test #45:
score: 0
Accepted
time: 31ms
memory: 7564kb
input:
120 50 dx m wzzelhkyfqpgp q vfe vnjqddqjn vef vq pgp qfykhle z zwmx d xicptk tu nhhqq ecjexegycscxxcscyg ex ejceq qhhnutktpci x nbwzga gpozigkbylar i wu g fcjj cfguwiraly bkg izopga gz wb n lpflmu vn dghqhcvz ninphqrpffprqh pninz vchqhgdnvuml fp l qcn nfw akn mgcheeg qtrvbhs si isshbvrtqgee hcgmnkaw...
output:
26830905
result:
ok single line: '26830905'
Test #46:
score: 0
Accepted
time: 29ms
memory: 7612kb
input:
50 50 addgg dbfdfdgabdc fddgcgecddceg cgddf cdbagdfdfbdggdda afeaabafabcgdaagefag cfebee be f cgafegaadgcbafabaaefa fcgdefcagedaefcce cdd dddcbbcdddddce ccfeadegacfedgcf cccfebfffgcgeggeggeeecbcffcbceeeg geggegcgfffbefccc ededcabcbgffgf c ebfbddebaggabeddbfbecfgffgbcbacdede ee bgffbdgdafeabbdgbceedd...
output:
336364575
result:
ok single line: '336364575'
Test #47:
score: 0
Accepted
time: 24ms
memory: 7940kb
input:
50 50 gbadcc bcbdfdbbebdbgcedgbaabgdecgbdbebbdfdbcbccdabg agdbbggdebafccb egdbdbcgccccgcbd bdgebccfab edggb bdga bbfbeea ecfadebgfafgadbbfddfbbdagfafgbedafceaeebfbb ggeacfc ed dccceffbcfbfcadffdacfbfcbffecccddecfcaegg faaecfg cgbbbebfdagacbgfdeedfgb ca gadfbebbbgcgfceaaf cacedfdccgbbg febdf b fa dca...
output:
108988450
result:
ok single line: '108988450'
Test #48:
score: 0
Accepted
time: 8ms
memory: 7188kb
input:
40 15 bbaaaaabaaaaabb aaaaaabbbaaaaaa baaabaabaabaaab aaaaabbabbaaaaa abbbaaaaaaabbba bbabbaabaabbabb aabaabaaabaabaa baabaaaaaaabaab aababbbabbbabaa aabbaababaabbaa abaabbbbbbbaaba bbaababbbabaabb bbbabbbabbbabbb abaaaababaaaaba aababbaaabbabaa aaabaabbbaabaaa baaaabababaaaab babaabaaabaabab bbbbaa...
output:
40
result:
ok single line: '40'
Test #49:
score: 0
Accepted
time: 49ms
memory: 7032kb
input:
100 50 gbge edfc f e dbfg ae eaddacegaagecaddaeeag fb defcfdeegbg da gdebgde edeeaegagdbg dagff gadgb dg agea eed eedgbedgad fgdf caebcdgacbga ag cdffda ccadffdcga agbca gdcbea cf dgf bgf efbafc d ab afegb aaf gf baccabfgfaa b gefabadcfabf efgb gbbdb c bfcaabg aagddbdbgabbbbagbdbddgaag baacfbcbdbb g...
output:
111774342
result:
ok single line: '111774342'
Test #50:
score: 0
Accepted
time: 50ms
memory: 7004kb
input:
100 50 agdd fefgd baa caeeggfeage fbb fe ga ef ggeeacaabdgf efddga cddgade bffcfbafabgdgbaaef f eaabgdgbafabfcff be dagd dc dca faceeebfgdeabdg gfgaedd ddeagfggdbae dgfbeeec afa c d gacbebgdd bcebaaddg eb ebdbggbdbe begddaabecbddgbe bcag dd dccaggdbbda bcf bfaf fegeaaege ffafbfcbadbbdggac cddd aac e...
output:
71957286
result:
ok single line: '71957286'
Test #51:
score: 0
Accepted
time: 48ms
memory: 7920kb
input:
120 50 faceaead eeg daecc bf fgag baggab gag ffbcceadgeeda eaecaf e eead gbegeg edg dc bea ea ebfc cf beaea ebcdgde gegebgd aeee g dadgebedc fe gggbd baegdcbc cbcdg eabd bgggefcd ebegdadg ffedbc gfcea cgfgedfecceee a ae ee cce fde gfgca ecf gcb deff dfffab cggaabef cd aaga dcca eeacc dagaadcfeb aagg...
output:
182654829
result:
ok single line: '182654829'
Test #52:
score: 0
Accepted
time: 53ms
memory: 7288kb
input:
120 50 geca gb d c eaf eabe bfe ccg feb ggbe fg ccefb eba efaecdbgaceg baceaddf db ccd acadgcabegbffbg eb acg dac adcc bdfdda ecab bcc ae cbdf acc ee ggcfgfeeacf f caeefg fc ggeeccaf dbce ac cb fdfdgedf bdd cg aeab gcca g bdggdb gaccgbaeagcddbfdegd fdf fgfccaf a efc defc bcbdaecbfgg fbcea dbcbcfe dc...
output:
338521041
result:
ok single line: '338521041'
Test #53:
score: 0
Accepted
time: 507ms
memory: 6828kb
input:
50 999 wmqvvinuzmakpepkamzun ivvqmw mbaarbyhjkcnhthnckjh ybraabm aepnver srsnaxbxa nsrsrevnp e a kfzkimxqxydujsjudyxqxmikzfk osrefuigeqzrjo jrzqegiuferso tbdlgdh lvrskhm hksrv lhdgldbt isl xuwtihjmbvkvbmjhitwuxlsi bfphvsmyks axvlvxaskymsvhpfb ztvcsdugoylgaaaglyogud sc vtz w uzircqsco tvglgvtocsqcriz...
output:
440739609
result:
ok single line: '440739609'
Test #54:
score: 0
Accepted
time: 513ms
memory: 7940kb
input:
50 999 vlqhevvcnyjfphpfjyncvvehql v xcfhppjaciuznsnzuic ajpphfcx bwaioxeigjvbeqebvjgie xo iawb uojgpq zfffwcvuvcwfffzqpgjou umkyefruqxbdwmwdbxqurfeykmu fpdsashcijhlkqklhjichs asdp f zodap eblkdgvirivgdklbepa doz em pr mnpteqhterethqetpnmrpm e gxzsinplcvqwukuwqv clpniszxg yxrsiruehtwzpgpzwtheu risrxy...
output:
240351931
result:
ok single line: '240351931'
Test #55:
score: 0
Accepted
time: 631ms
memory: 7300kb
input:
100 999 uwxipe m cqk amsosmakqcme pix wu ohf tlcasrbgren ergbrsac ltfho ojjabwyqoydryfyr dy oqywbajjo owsr boyuzdwvw jwvwd zu yobrswo gwrhbrmxs wrzkpkzrws x mrbhrwg nk mmafyoi r n adhdan rioyfamm kn d hwculzkoymqxax q myokzlu c whd fjtdeiexi oqplp l pqoixeiedtjf i vk ocltbnld uo joudlnbt lcok vi bub...
output:
394342113
result:
ok single line: '394342113'
Test #56:
score: 0
Accepted
time: 642ms
memory: 8088kb
input:
100 999 jjlwnaqsksohdodhosk sqanwlj j bufuux syjk xwu buwxkjysxuu fub zkwyzv h nejvviwivv jenh vz ywkz blaqavcv qpr aenearpqv cvaqalb xygwlyhyouds ososduoyhylwgyx bsxcvl bel iicv a vciilebl vcxsb spvctow ck qmqrzr qmqkc w otcvp s t zgki u mgy spblr lbp sygmuikgzt qhve mcqdqthkylykhtqdq cmevhq mcikct...
output:
934790014
result:
ok single line: '934790014'
Test #57:
score: 0
Accepted
time: 692ms
memory: 7960kb
input:
120 999 qddz fgla xqbuol oub qxalgf zddq nmza r e sf xpkdsf sdkpxfse razmn yf x xshp umf nqr arqn fmuphsxxf y bz bixbqwty q ypxp yqytwq bx i bzb uc p lhmvo kjgmqgq mg jkovmhlpcu lboq dmzqt sy npb pn ystqzmd qobl c a kkcy syc ibqk dkqbicys yc kkac ha orslxdgxadsu sdaxgd xlsroah mvtf osf aqneydvd yenq...
output:
718373891
result:
ok single line: '718373891'
Test #58:
score: 0
Accepted
time: 689ms
memory: 7320kb
input:
120 999 r swwoiztkpewbabwepktzioww sr pm mu tv qnuh fvxixvf hun qv tummp hdrhxfaxjsxeo zoe xsj xa fx hr dh hc e ixtianzxlcqclxznaitxie ch cjjct vgkahifada fihak g vtcj j c swob ukydislhcechlsidyk ubows pvgksylvi hbx ioi xbhi vlyskgvp t q cclfyvb bqgwi wgqbbvy flcc qt jvoa tfjvxaagg o ggaaxvjfta ovj ...
output:
782458717
result:
ok single line: '782458717'
Test #59:
score: 0
Accepted
time: 8ms
memory: 7932kb
input:
40 15 ababaaaaaaababa aaaabaaaaabaaaa baababaaababaab abaabbababbaaba abaabaaaaabaaba bbaabbaaabbaabb aababababababaa bababaaaaababab aabbaaabaaabba aabbbbaaabbbbaa bbaaabaaabaaabb aabbbaaaaabbbaa aabbaabbbaabbaa baabababababaab bbbbbabaaaaabaa bbabaabbbaababb bbbaaabbbaaabbb baabaababaabaab aabaabb...
output:
35
result:
ok single line: '35'
Test #60:
score: 0
Accepted
time: 586ms
memory: 8244kb
input:
50 999 afggdcegdacc gfgccadgecdggfa bafgcgddgccfbbbfccgddgcgfab efdbfbff egfbf afbfgeffbfbdfe gdagbbeabbdcafacdbbaebbgadg bgbgc ggggcbb bbbbbcggggcgbgb ffaffcaebcfgdgdgfcbeacffaff dgbbgcdaccaga bagac cadcgbbgd ecfgdgdebcdgcbcgdcbedgdgfce gggbbcdg dbdcegecdbdgdcbbggg agbbbdcfdbafafafabdfcdbbbga bf eg...
output:
60641896
result:
ok single line: '60641896'
Test #61:
score: 0
Accepted
time: 557ms
memory: 6840kb
input:
50 999 ebcbagggfgbgfffgb gfgggabcbe geagfcgfcgbbdddbbgcfgcfgaeg gcfffefgegbfgegfbgegfefffcg dbfa fbcbecbdfdfdbcebcbfafbd gbcbee dbccbaabaabccbdeeb cbg dbdffbgdef fefdfeffedgbf fdbd fbbafabaacdbgcgbd ca abafabbf bdegcgaeefegcfcgefe eagcgedb aaabfbeeebaafcfaabeeebfbaaa ffcfebfbbadbfcfbdabbfbefcff fd g...
output:
265212824
result:
ok single line: '265212824'
Test #62:
score: 0
Accepted
time: 1050ms
memory: 7028kb
input:
100 999 adaaef bfbagcf gfcga bfbfeaada dgeddbgffg fb bebbfgffgbddegd aeeg fdgafafe egeefafagdf geea gadd afdda bgaeb ea gbaddfa d dag adbfbce ffgagefeg a gffecbfbda f ca daaggbaagfgf gaabggaadacf adcd debged ggc ccg gdegbeddcda fdeeebg bbdabfafba dbbg beeedf dbaaddffgcga gfga gc gffddaabd dfdf geg d...
output:
889332053
result:
ok single line: '889332053'
Test #63:
score: 0
Accepted
time: 1048ms
memory: 7964kb
input:
100 999 d gd adcbcegcfaeafcg e cb cd adgd egaabffae ccae beacceaffbaage bgd cdbbf fb b deaedbbf fbbdcdgb ac becce ec eefd edfeecee cce bca bad ggecgccf eag aefcc gc egg dab c cad edbfgdebadabedgfbdedacc bge efcfgbf ebeeeb efbgf cfeegb ad edeg fecg eafbfaegcefg eded a dadaafege ab ecf cebaegef aa dad...
output:
975777964
result:
ok single line: '975777964'
Test #64:
score: 0
Accepted
time: 1103ms
memory: 7028kb
input:
120 999 bda g badcdea ccecca ed c dabgadb de e debcgbddg d ddgddb gcb edeed ce dfacbc eafb bebbfae cbcafdec cfebddddaccae eeaccaddddb efc bccedadefce egdgeecfed adec cb dfd a baacefbgdgdgbf ec aabadfd fef ccgegadd bed ebdd ag eg ccfef cebadgbbg agda dadgagbbgd abec afdag gcac gbfedefb gca cggadfa bc...
output:
140229783
result:
ok single line: '140229783'
Test #65:
score: 0
Accepted
time: 1108ms
memory: 7316kb
input:
120 999 egedce ffag fd bcbdf gaff ecdege ddgd bcfecbeb dg dbebcefcbd g dd cac eab aebce agbga e cbeab aecac cdcffaa gdfd abebadfdgaaffcd c cddcadddcafbefe bfac d ddacddc a bbbfge afdcfbf bfcdf aegfb bba fgf dccbgebbfgegfbb egb ccdfgf facdad cfegfda eadf gefcda dcaf cbdac gf af fgbdbd b gffa fgcadbc ...
output:
462472220
result:
ok single line: '462472220'
Test #66:
score: 0
Accepted
time: 499ms
memory: 7968kb
input:
50 1000 jokdoo dsteets doodkoj fytqqsqxxhhxxqsqqtyf nphjsjkxattaxkjsjhpn uxo qbzcvnnnnvczbqoxu htjyejswviivwsjeyjth gbensdzhkrrkhzdsnebg yudadvexjxxjxevdaduy pgpraqusejjesuqarp gp crfvpkxpkttkpxkpvfrc yxgmdqlp wqq wplqdmgxy cvtsdzlnjttjnlz dstvc mubssxlltuutllxs sbum cttdkdstzcczt sdkd ttc piy evokc...
output:
592531190
result:
ok single line: '592531190'
Test #67:
score: 0
Accepted
time: 520ms
memory: 7056kb
input:
50 1000 ieqbtm jtkkkktjmtbqei cywkzohtvssvthozkwyc tnjjnx yuco ocuyxnjjnt dnjc kzisccccsizkcjnd hsagfjvt mhhmtvjfgash jvdhvaqqlkklqqavhdvj xzcvxolxttttxloxvczx ibzcwgasqllqsag wczbi niqfeamddooddmaefqin gbonqydnaggandyqnobg wmuzfkfkzrrzkfkfzumw g ljrkcsmcqqcmsckrjlg nmidtzrqgmmgqrztdimn omd lbxwfctt...
output:
869827957
result:
ok single line: '869827957'
Test #68:
score: 0
Accepted
time: 630ms
memory: 8076kb
input:
100 1000 hhmexseh fssfhesxemhh lb th ksqvqwwq vqskhtbl xeldiwqufaafuqwidl ex cdqqffmhujju hmf fqqdc cwinzzyscbbcsyzzniw c dj zjkd hlntt nlhdkj zjd y f fch jsnjhhjnsjhcffy erupx qegm hhmgeqxpure hex szx ayff ff yaxz sxeh xm axdil huz zuhlidxamx rbitxudo tjjtoduxtib r rrtdh brixrrxirbhdtrr bpmz tousdv...
output:
240955559
result:
ok single line: '240955559'
Test #69:
score: 0
Accepted
time: 623ms
memory: 7276kb
input:
100 1000 axg tafjwicciwjfa t gxa uwceaatufxxfu ta aecw u xitoooiunzznui oootix udi yyppnnoon n ppyy idu p fxo jn pctjjtcpnjoxfp olncifuuzoozuufic nlo awem dvr tfzzftrvdmew a i gq wujw uouuou wju wqgi ivcvc nsdf ssf dsncvcvi makxsxbwdxxdw bxsxkam sshhgh vgnkkngv hghh ss mnjn lc ut qeeqtu cln jnm lcpw...
output:
60110416
result:
ok single line: '60110416'
Test #70:
score: 0
Accepted
time: 7ms
memory: 6828kb
input:
40 15 babaaabbbaaaba aababaaababaa bbbaaabaaabbb abbabaabaababb aaaaabaaabaaaa abbaaaaaaabba aabaabbbaabaab aabbbaaabbbaab bbaaabbbaaabb abaaabbabbaaaba ababababababab baaaabaaaaaabab bbbabbabbabbba bababbabbababb babbaababaabbab aaabababababaa bbbaaaaabbbbaaa bbbabbbbbbbabb abaabbabbaaba aaaabbbbba...
output:
11
result:
ok single line: '11'
Test #71:
score: 0
Accepted
time: 699ms
memory: 8036kb
input:
120 1000 ewigf yykpd d pkyy fgiwe thfk cw jppkkppjwckfht qej osdqtfbb ftqdsoje q mbk dhlchiuuihclhdkbm wxkwtbtxjbb jxtb twkx w avc vl ptqiyyiq tplvcva fdxbncksty ytskc nbxdf mj c jism touu otms ijcjm v tih syvx hxxh xvy shitv hpevphrhzyyz hrhpveph ouwsia i xerrexiaiswuo abztsy lrummurlystzba bxg daj...
output:
763293821
result:
ok single line: '763293821'
Test #72:
score: 0
Accepted
time: 723ms
memory: 7060kb
input:
120 1000 wct vrng mqzzqmgnrvtcw u c ur lrvyh ddhyvr lrucu gvlkcc akthhtka ccklvg ibrpswpmgcc gmpwsprbi cuay s toij ttj iots yauc guuo ihut ig git uhio uug ydesofeonjjnoefos edy npvgykzt owwot zkygvpn xkcrai suc eecusiarckx b esenmqdtxxtdqmn eseb jrddd gvxpddpxvg dddrj rtra rk lw ku ukwlk rartr hltpg...
output:
495766756
result:
ok single line: '495766756'
Test #73:
score: 0
Accepted
time: 575ms
memory: 7168kb
input:
50 1000 fdbbdaadffffdaadbbdf gaagedebeeeebedegaag dbfeabaegdd g eabaefbd cgfbbgeeaccaeegbbfgc eabdb gedffffdegbdbae bdg cfccbbddbbccfcgdb fc cfefc feggefcfefccf febfdbagfaafgabdfbef dfceagfbaccabfgaecfd cdbceeadecce daeecbdc ggddabe daddadeba ddgg gacegdgedeedegdgecag gaebddaddggddaddbeag cfeaeaggab...
output:
154566828
result:
ok single line: '154566828'
Test #74:
score: 0
Accepted
time: 582ms
memory: 6824kb
input:
50 1000 ggfcefbebccbebfecfgg babbgabgfddfgbagbbab egfcdacefccfecadcfge dfbagedfbcc bfdegabfd dgbgge aecdd c eaegg bgd daacdgfgaffagfgdcaad ega bbbgedbbdegbbba ge feaaegdddccdd dgeaaef dgcaegaafggfaageacgd eedaggfefeefefggadee dafgggcgccccgcgggfad bdeeebcgebbegcbeeedb fadceagebffbegaecdaf caace dabfc...
output:
349931605
result:
ok single line: '349931605'
Test #75:
score: 0
Accepted
time: 1073ms
memory: 6972kb
input:
100 1000 a cbegbaaeggeaabg e bca bcaeb ge eaeeaeegbeacb fagadfafabbafafdag af fcagfbdffdd ffdb f gacf fg bg eabec ccc ebaegb gf ag debbgccggccgbbedga aegf fbfd aaaa df bff gea b bgbcabggaaggbacbgbb dcaedab adbbdabadeacd cdbabc dgaddagdcbabd c cgdd dfe bbaa bbefdd dgc fceaecdabbbb ad ceaecf bcddd aad...
output:
269597200
result:
ok single line: '269597200'
Test #76:
score: 0
Accepted
time: 992ms
memory: 7456kb
input:
100 1000 fffadcdegeegedcdafff gfecgfccba abccfgcefg e fcbb cgcdeedcgcbbcfe ccgbfegbbaabbgefbgcc cc fbbcfedccdefcbbfcc fdfbfd afge egf adf bfdf bdcafaedgdd gdeaf a cdb gd dgdgbagffga bgd gdd g gcfbcd gf fddff gdcbfcg dbaadaedecc edeada abd acfbd gecg gggceg dbfca dddef fcafaa facffeddd dgbfddbac ggca...
output:
36498743
result:
ok single line: '36498743'
Test #77:
score: 0
Accepted
time: 1113ms
memory: 7056kb
input:
120 1000 ebddf acdgccgdcafddb e gcgdegcade ed acgedgc g edbfeabbga agbbaefbde acbg dgfgeaae gfgdgbca dgbbeecdfggfdc ee b bgd afdbd c gfffff fg cdbdf a cb bfd fbc fccfc bfdfb bc ddcffabfggggfbaffcdd egbgfagbcbbcbg afgbge ecbcecec gaa gc ec ecbce egc ff edgbaab gdeffc ge f gbdffdba bbab dffdbgf de da ...
output:
511078806
result:
ok single line: '511078806'
Test #78:
score: 0
Accepted
time: 1123ms
memory: 8260kb
input:
120 1000 bf gc gfaac b bcaafgcgfb dac afdbaggggabdf acad cadff ggd baa bdg gffdac ddcafbbe a ccaebbfacdd cfc agg cfcffcfcggacfc cccedgge edde eg gdeccc aeecffdfge egfdffceea eda gdbeg cffcgebdga de adbeeaea cb bcaeaeebda edbf bceebc cbeecb fbd e fddgbbb dfaafd bbbg dd f gefdbfcgfaafgc fbdfeg bdfcbgg...
output:
497226421
result:
ok single line: '497226421'
Test #79:
score: -100
Time Limit Exceeded
input:
84 999 a b aaaaaaaaaaa baaaaaaaaaaa abaa aaaaaaa aab aabaa abba abaaaaaaaaba baba aa aabaaaa ba abaaaaaaa aaaa aaaaaaaaaaaa aaabaaaaaaa ab aaaba aaaaaaaa baa aaaaabaaaaaa aba babaaaa aaaaaaaabaaa aaa aaaaaba aaaaa aaaaaab aaaaaa abaaaaaaaaaa aaaab aaaaabaaaaa aaabaaaa aabaaaaa baaaa aabaaaaaaaaa aaa...