QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#142114 | #5368. 异世界的文章分割者 | DaiRuiChen007 | 60 | 63ms | 13396kb | C++14 | 2.2kb | 2023-08-18 15:04:46 | 2023-08-18 15:04:48 |
Judging History
answer
#include<bits/stdc++.h>
#define int long long
using namespace std;
const int MAXN=5e4+5,inf=1e18;
struct Node {
unordered_map <char,int> ch;
int link,len;
} tr[MAXN<<1];
int lst,tot;
inline void init() {
for(int i=1;i<=tot;++i) {
tr[i].link=tr[i].len=0;
tr[i].ch.clear();
}
lst=tot=1;
}
inline int insert(char c) {
int cur=++tot,p=lst;
tr[cur].len=tr[lst].len+1;
while(p&&!tr[p].ch.count(c)) tr[p].ch[c]=cur,p=tr[p].link;
if(!p) tr[cur].link=1;
else {
int q=tr[p].ch[c];
if(tr[q].len==tr[p].len+1) tr[cur].link=q;
else {
int r=++tot;
tr[r]=tr[q],tr[r].len=tr[p].len+1;
tr[cur].link=tr[q].link=r;
while(p&&tr[p].ch[c]==q) tr[p].ch[c]=r,p=tr[p].link;
}
}
return lst=cur;
} //SAM
char str[MAXN];
int q[MAXN],w[MAXN],st[MAXN<<1],ed[MAXN<<1]; //ans[i]=qi+w
inline int eval(int l,int r) { //get val(S[l,r])
fill(st+1,st+tot+1,inf),fill(ed+1,ed+tot+1,-inf);
init();
fill(q+l,q+r+1,0),fill(w+l,w+r+1,0);
for(int i=l;i<=r;++i) {
int p=insert(str[i]);
st[p]=ed[p]=i;
}
vector <vector<int>> Nodes(r-l+2);
for(int i=2;i<=tot;++i) Nodes[tr[i].len].push_back(i);
for(int i=r-l+1;i;--i) {
for(int p:Nodes[i]) {
st[tr[p].link]=min(st[tr[p].link],st[p]);
ed[tr[p].link]=max(ed[tr[p].link],ed[p]);
}
}
for(int i=2;i<=tot;++i) {
auto add=[&](int x,int y,int nq,int nw) {
if(x>y) return ;
q[x]+=nq,w[x]+=nw;
if(y<r) q[y+1]-=nq,w[y+1]-=nw;
};
int mx=tr[i].len,mn=tr[tr[i].link].len;
add(st[i]+1,ed[i]-mx,0,mx-mn);
add(max(st[i]+1,ed[i]-mx+1),ed[i]-mn,-1,ed[i]-mn+1);
}
int ans=0;
for(int i=l+1;i<=r;++i) {
q[i]+=q[i-1],w[i]+=w[i-1];
ans+=(q[i]*i+w[i])*(q[i]*i+w[i]);
}
return ans;
}
int n,k;
inline bool check(int x) {
int st=1,tot=0;
while(st<=n) {
if((++tot)>k) return false;
auto judge=[&](int len) {
if(st+len-1<=n) return eval(st,st+len-1)<=x;
return false;
};
int k=1,len=0;
while(judge(1<<k)) ++k;
len=1<<(k-1);
for(int d=k-2;~d;--d) if(judge(len+(1<<d))) len+=1<<d;
st+=len;
}
return true;
}
signed main() {
scanf("%lld%lld%s",&n,&k,str+1);
int l=0,r=inf,res=0;
while(l<=r) {
int mid=(l+r)>>1;
if(check(mid)) res=mid,r=mid-1;
else l=mid+1;
}
printf("%lld\n",res);
return 0;
}
Details
Tip: Click on the bar to expand more detailed information
Subtask #1:
score: 10
Accepted
Test #1:
score: 10
Accepted
time: 1ms
memory: 12824kb
input:
10 3 aaaaaaaaaa
output:
6
result:
ok single line: '6'
Test #2:
score: 0
Accepted
time: 3ms
memory: 12396kb
input:
10 1 abbbaabbba
output:
289
result:
ok single line: '289'
Test #3:
score: 0
Accepted
time: 3ms
memory: 12764kb
input:
10 2 cacabbcbca
output:
11
result:
ok single line: '11'
Test #4:
score: 0
Accepted
time: 0ms
memory: 12976kb
input:
10 4 aabbccddaa
output:
1
result:
ok single line: '1'
Test #5:
score: 0
Accepted
time: 3ms
memory: 11756kb
input:
10 4 ababbbabab
output:
2
result:
ok single line: '2'
Test #6:
score: 0
Accepted
time: 3ms
memory: 12304kb
input:
10 2 ababbaaaba
output:
12
result:
ok single line: '12'
Test #7:
score: 0
Accepted
time: 3ms
memory: 12984kb
input:
10 1 baabaababa
output:
156
result:
ok single line: '156'
Test #8:
score: 0
Accepted
time: 3ms
memory: 11468kb
input:
10 10 hbjebnidnq
output:
0
result:
ok single line: '0'
Subtask #2:
score: 10
Accepted
Dependency #1:
100%
Accepted
Test #9:
score: 10
Accepted
time: 5ms
memory: 11604kb
input:
50 10 aababaaabaabaaabababaaaaaabbbababbaababaaaabababba
output:
17
result:
ok single line: '17'
Test #10:
score: 0
Accepted
time: 5ms
memory: 11532kb
input:
50 5 bbbaabbbbbaabaababbbbbbaaaaababbbaaabaaaaaabbabaab
output:
91
result:
ok single line: '91'
Test #11:
score: 0
Accepted
time: 1ms
memory: 12324kb
input:
50 5 adbabadbabadbabadbabadbabadbabadbabadbabadbabadbab
output:
412
result:
ok single line: '412'
Test #12:
score: 0
Accepted
time: 0ms
memory: 12816kb
input:
50 3 caaabcaaabcaaabcaaabcaaabcaaabcaaabcaaabcaaabcaaab
output:
3222
result:
ok single line: '3222'
Test #13:
score: 0
Accepted
time: 1ms
memory: 12740kb
input:
50 1 cadabcadabcadcadabcadabcadcadabcadcadabcadabcadcad
output:
407986
result:
ok single line: '407986'
Test #14:
score: 0
Accepted
time: 4ms
memory: 12168kb
input:
50 15 bbbbbbabaabaaaabaaabbaababbaaabababbbbaabaababaaba
output:
3
result:
ok single line: '3'
Test #15:
score: 0
Accepted
time: 1ms
memory: 12716kb
input:
50 20 baaaaaaaabbabbababbaaaabbabaabbababbbabbbabaaabaaa
output:
2
result:
ok single line: '2'
Test #16:
score: 0
Accepted
time: 4ms
memory: 12744kb
input:
50 6 ababbbbaaaaabbbabaabaaabaaabababababbaaaababbbbbab
output:
65
result:
ok single line: '65'
Test #17:
score: 0
Accepted
time: 4ms
memory: 12896kb
input:
50 1 aabbaabbaabbaabbaabbaabbaabbaabbaabbaabbaabbaabbaa
output:
129389
result:
ok single line: '129389'
Test #18:
score: 0
Accepted
time: 4ms
memory: 11896kb
input:
50 1 acbcaabcababaacbbacaabcbacccbbaacaccbabccacaccaabb
output:
16446
result:
ok single line: '16446'
Test #19:
score: 0
Accepted
time: 4ms
memory: 11868kb
input:
50 14 ccaccaccaccaccaccaccaccaccaccaccaccaccaccaccaccacc
output:
6
result:
ok single line: '6'
Test #20:
score: 0
Accepted
time: 4ms
memory: 11576kb
input:
50 24 aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
output:
2
result:
ok single line: '2'
Test #21:
score: 0
Accepted
time: 0ms
memory: 11544kb
input:
50 50 txcopptgjrvkgzdvaxgrhwgnkjfbspyytzkbirczhcrctddsfj
output:
0
result:
ok single line: '0'
Subtask #3:
score: 20
Accepted
Dependency #1:
100%
Accepted
Dependency #2:
100%
Accepted
Test #22:
score: 20
Accepted
time: 3ms
memory: 11364kb
input:
200 1 cabaababbabbbcabcbcaacbccaabcacbccaabbccccbcabbcacbbcbacbccaabbbbcbcabbacabbacccbbbbbacccabcccaaacbcbaaaccabbbabcaabbbababcabccbccbaaabbbcbccbbcacbbabbaabcacbcaccccccaaaccabbaaabbbcbbccbcabbbcabcccabb
output:
2192936
result:
ok single line: '2192936'
Test #23:
score: 0
Accepted
time: 3ms
memory: 11744kb
input:
200 2 cbaacbaacbaacbaacbaacbaacbaacbaacbaacbaacbaacbaacbaacbaacbaacbaacbaacbaacbaacbaacbaacbaacbaacbaacbaacbaacbaacbaacbaacbaacbaacbaacbaacbaacbaacbaacbaacbaacbaacbaacbaacbaacbaacbaacbaacbaacbaacbaacbaacbaa
output:
1196175
result:
ok single line: '1196175'
Test #24:
score: 0
Accepted
time: 10ms
memory: 11236kb
input:
200 3 acabacbacacabacbacacabacacabacbacacabacbacacabacacabacbacacabacacabacbacacabacbacacabacacabacbacacabacbacacabacacabacbacacabacacabacbacacabacbacacabacacabacbacacabacacabacbacacabacbacacabacacabacbacac
output:
1550907
result:
ok single line: '1550907'
Test #25:
score: 0
Accepted
time: 10ms
memory: 12824kb
input:
200 7 hefdaadcdgfecghbgcbggfgdfchchgbdfafghahacgbbcebfchadbcechdacacccahggadbdacbggadbgceacgeedfafbhhfhaacdccefddbfaffcdggabhhcghcbfbedddeheaeaabdahhbhcefeededbfdafghdahcfbfbcbbdgccffhaeggcdhdcghghfaaefechd
output:
1134
result:
ok single line: '1134'
Test #26:
score: 0
Accepted
time: 9ms
memory: 12680kb
input:
200 11 lmmeigmkegfbcmhfedchmeckbnbgjlfljahjleeldlnkdlnkngaeiiblangdlkdfjchalckfhfcjgljlelebhfacafkjknknjjfklnhcnlgkkjmhfafmhehgehmejajabgaikfnclihbkmeckghfljgfmajflilgcimamgljlhjkfhgjcbcddfjlnchcgedmghdlfaib
output:
155
result:
ok single line: '155'
Test #27:
score: 0
Accepted
time: 4ms
memory: 13044kb
input:
200 19 cdcccacbaccdcccacbaccdcccacbaccdcccacbaccdcccacbaccdcccacbaccdcccacbaccdcccacbaccdcccacbaccdcccacbaccdcccacbaccdcccacbaccdcccacbaccdcccacbaccdcccacbaccdcccacbaccdcccacbaccdcccacbaccdcccacbaccdcccacbac
output:
133
result:
ok single line: '133'
Test #28:
score: 0
Accepted
time: 4ms
memory: 13100kb
input:
200 16 acdbddbaacdbddbaacdbacdbddbaacdbddbaacdbacdbddbaacdbacdbddbaacdbddbaacdbacdbddbaacdbddbaacdbacdbddbaacdbacdbddbaacdbddbaacdbacdbddbaacdbacdbddbaacdbddbaacdbacdbddbaacdbddbaacdbacdbddbaacdbacdbddbaacdb
output:
481
result:
ok single line: '481'
Test #29:
score: 0
Accepted
time: 4ms
memory: 12220kb
input:
200 25 abacdacdabacdacdabacdabacdacdabacdacdabacdabacdacdabacdabacdacdabacdacdabacdabacdacdabacdacdabacdabacdacdabacdabacdacdabacdacdabacdabacdacdabacdabacdacdabacdacdabacdabacdacdabacdacdabacdabacdacdabacda
output:
99
result:
ok single line: '99'
Test #30:
score: 0
Accepted
time: 2ms
memory: 11440kb
input:
200 25 aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaadkgmivxnitlfmciurqeqnqghxveqrxidxbmzlpdveuucarjwdqyiiaegadulttqmkzinvxalbvnccchfvjechxnufmcmofrdkesmkjeiobfzwbppknslhtxoranwbjnxggudgjmjrigintzxkusvvaqwhuwvoyiz
output:
6
result:
ok single line: '6'
Test #31:
score: 0
Accepted
time: 6ms
memory: 12732kb
input:
200 37 aaaaaaaaaaaaabdecdebedebaaaaaaaaaaaaaaaacebcbcecaebeaaaaaaaaaaaaaebcddecebbebaaaaaaaaaaaaaaeadaaecdadbaeaaaaaaaaaaaaaccbabdbbeedaeaaaaaaaaaaaaadbddbebeddcbeaaaaaaaaaaaaaaceeedcecdadbaaaaaaaaaaaaaaaaaa
output:
10
result:
ok single line: '10'
Test #32:
score: 0
Accepted
time: 10ms
memory: 12816kb
input:
200 64 bbabbbaaaabababaabbaaaabbabbbaabbaababababbbaabbbbbbbbbabbbbabaababbbbabbbabbbaabbbbbaabaabbbbbbababbbabbaaaababbbbabbbaaaaaaabbabbaabaabaabbaaabbaaaaaabaabbbbaaaaabbababbaabaabbbbbabbbbababbbbaaabaab
output:
2
result:
ok single line: '2'
Test #33:
score: 0
Accepted
time: 3ms
memory: 12788kb
input:
200 49 abbabbabbabbabbabbabbabbabbabbabbabbabbabbabbabbabbabbabbabbabbabbabbabbabbabbabbabbabbabbabbabbabbabbabbabbabbabbabbabbabbabbabbabbabbabbabbabbabbabbabbabbabbabbabbabbabbabbabbabbabbabbabbabbabbabbab
output:
10
result:
ok single line: '10'
Test #34:
score: 0
Accepted
time: 4ms
memory: 11928kb
input:
200 57 zbizbizbzbizbizbzbizbzbizbizbzbizbizbzbizbzbizbizbzbizbzbizbizbzbizbizbzbizbzbizbizbzbizbizbzbizbzbizbizbzbizbzbizbizbzbizbizbzbizbzbizbizbzbizbzbizbizbzbizbizbzbizbzbizbizbzbizbizbzbizbzbizbizbzbizbz
output:
3
result:
ok single line: '3'
Test #35:
score: 0
Accepted
time: 10ms
memory: 11408kb
input:
200 44 aaaaaaacdaadaaaaaaabdbbaaaaaaaaaacbdaaaaaadccdcbaaaaaabdcdadaaaaaaccdabbaaaaaadcbaadaaaaaacdcdbaaaaaaabbcbdbaaaaaaabacbbaaaaaabcbccdaaaaaadbaabdaaaaaadaacddaaaaaaadcdbcaaaaaabbcdcaadbbdccdacdbcaccdbbd
output:
6
result:
ok single line: '6'
Subtask #4:
score: 20
Accepted
Dependency #1:
100%
Accepted
Dependency #2:
100%
Accepted
Dependency #3:
100%
Accepted
Test #36:
score: 20
Accepted
time: 29ms
memory: 12508kb
input:
1000 153 aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa...
output:
28
result:
ok single line: '28'
Test #37:
score: 0
Accepted
time: 58ms
memory: 12824kb
input:
1000 79 babacbbcacbbccccababbacbacacbbcabcabbaaabccbacbaacccaaaaabbcabaabcaaabccccbbaabbcaccaaacccbaaacaacccaccababaacbcbbacbcbbbcccbbcbaaababbcbacaacaccbcacaaccbbbcaabcaababbcbbabbccaccbccabaacbcacbbccbbcbaaccbcaacccacccccabbbabccacbbbbcaabccccacababacaccacbcccbcccbaccabaacbaccabbcbbacaabcbcacccaac...
output:
200
result:
ok single line: '200'
Test #38:
score: 0
Accepted
time: 63ms
memory: 13088kb
input:
1000 6 ahcfaddebbbccheeffbfdbbbdcjhdefhcibhgjbgeaigaaifcbdfbjdjiddicbhagggaaaajiejjjfdabcjjjceieaijacjbaecifacgdajcigfababaddecfehdhfbfjhdahchahiiiafaibdbbdegeachfdicciaegdcagaahgdgebdhbdejajafajjjfdjfjdijjgahjdjjjifeejjbachjaiacgjfhccebjgddjehiecibjfheicgihfdabhbdiijbcdgffaedcejecciddahjajdfjiddhgc...
output:
237763
result:
ok single line: '237763'
Test #39:
score: 0
Accepted
time: 54ms
memory: 12052kb
input:
1000 79 cfbdcgcdcdgabebecbbgcebcgefcbdageefffaddafegeabdagdaaabeaedgabgedafdegdggbedcceafgegbceceebaaadbccgadebeaeebcaggdbdgefeaeegafgbaeegaadbcaeddceecacbecdgfaefaeagdbaadbdfceedgdabfbaadcffgbedfgbbdddbcgdfccaeabbgabdfgefcefbaadefcfagebegfafbabfcbaagbedacfgffefadcdecbabbcfaegcgcddbagceaaaabcfacgfbe...
output:
91
result:
ok single line: '91'
Test #40:
score: 0
Accepted
time: 63ms
memory: 12940kb
input:
1000 3 htspasbnfsqdnsppbkaaprldgjpfaikdjcaojaejdtipsrkrfddlkepkqbjprsejnpcqigqjkmpqfhbbglccmtrrngoopfscopnocqkfesphqnteofsinkqqopnknbkejodkpnmjobgcisimpsgnqqidtfsdjakntlkgtgnnaietrijhgksrsnohilbrrtcpndciksonfptfkljhhisihcngqsdmgreakrrgmgnspabhfmegnmhtlhkrfnliipssjcbdikfgqmjtaltootaaopdrfrfrdaelnbrdd...
output:
1022595
result:
ok single line: '1022595'
Test #41:
score: 0
Accepted
time: 59ms
memory: 11860kb
input:
1000 14 jmgovzbodqoznwcmegtwxcunytkvnnoqixxjgbspvoochcctbmgfcofmdctzmpxwqwztunedfpvrdbbgujrmowvbahioiwnewuidqkajpxdkwckpmmbrkbrebgiqdktjgeaktrcgcaduslvxlpqofscjzmjmjyyzpvogthoglxsdvqpvcccfljopkcudctgxjovrppnbyzairtebpggtheutanrfalcsakvcreyxxchzalfaybwptnbulyteeuapgoscpzvigwetrjhtzxtgzhehhknztxhcvrbw...
output:
11558
result:
ok single line: '11558'
Test #42:
score: 0
Accepted
time: 28ms
memory: 12788kb
input:
1000 102 bacaabacaabacaabacaabacaabacaabacaabacaabacaabacaabacaabacaabacaabacaabacaabacaabacaabacaabacaabacaabacaabacaabacaabacaabacaabacaabacaabacaabacaabacaabacaabacaabacaabacaabacaabacaabacaabacaabacaabacaabacaabacaabacaabacaabacaabacaabacaabacaabacaabacaabacaabacaabacaabacaabacaabacaabacaabacaab...
output:
384
result:
ok single line: '384'
Test #43:
score: 0
Accepted
time: 36ms
memory: 13248kb
input:
1000 11 dfbkbjdlafmdkfifefkbcblkmjhjhidabdhgcdfbkbjdlafmdkfifefkbcblkmjhjhidabdhgcdfbkbjdlafmdkfifefkbcblkmjhjhidabdhgcdfbkbjdlafmdkfifefkbcblkmjhjhidabdhgcdfbkbjdlafmdkfifefkbcblkmjhjhidabdhgcdfbkbjdlafmdkfifefkbcblkmjhjhidabdhgcdfbkbjdlafmdkfifefkbcblkmjhjhidabdhgcdfbkbjdlafmdkfifefkbcblkmjhjhidab...
output:
15796914
result:
ok single line: '15796914'
Test #44:
score: 0
Accepted
time: 43ms
memory: 13232kb
input:
1000 3 cmabiacablhoadfenghhdekggicmfkhennaifblffiofabfdkmlcklkndoiognhfihbocmabiacablhoadfenghhdekggicmfkhennaifblffiofabfdkmlcklkndoiognhfihbocmabiacablhoadfenghhdekggicmfkhennaifblffiofabfdkmlcklkndoiognhfihbocmabiacablhoadfenghhdekggicmfkhennaifblffiofabfdkmlcklkndoiognhfihbocmabiacablhoadfenghhd...
output:
6797306034
result:
ok single line: '6797306034'
Test #45:
score: 0
Accepted
time: 30ms
memory: 11480kb
input:
1000 1 deebcabbaeeaadeebcabbaeeaadeebcabbaeeaadeebcabbaeeaadeebcabbaeeaadeebcabbaeeaadeebcabbaeeaadeebcabbaeeaadeebcabbaeeaadeebcabbaeeaadeebcabbaeeaadeebcabbaeeaadeebcabbaeeaadeebcabbaeeaadeebcabbaeeaadeebcabbaeeaadeebcabbaeeaadeebcabbaeeaadeebcabbaeeaadeebcabbaeeaadeebcabbaeeaadeebcabbaeeaadeebcab...
output:
13523081623
result:
ok single line: '13523081623'
Test #46:
score: 0
Accepted
time: 28ms
memory: 12896kb
input:
1000 176 ddcddcaaddcddcaaddcddcaaddcddcaaddcddcaaddcddcaaddcddcaaddcddcaaddcddcaaddcddcaaddcddcaaddcddcaaddcddcaaddcddcaaddcddcaaddcddcaaddcddcaaddcddcaaddcddcaaddcddcaaddcddcaaddcddcaaddcddcaaddcddcaaddcddcaaddcddcaaddcddcaaddcddcaaddcddcaaddcddcaaddcddcaaddcddcaaddcddcaaddcddcaaddcddcaaddcddcaaddc...
output:
15
result:
ok single line: '15'
Test #47:
score: 0
Accepted
time: 31ms
memory: 12008kb
input:
1000 176 dcbdbdcbdbdcbdbdcbdbdcbdbdcbdbdcbdbdcbdbdcbdbdcbdbdcbdbdcbdbdcbdbdcbdbdcbdbdcbdbdcbdbdcbdbdcbdbdcbdbdcbdbdcbdbdcbdbdcbdbdcbdbdcbdbdcbdbdcbdbdcbdbdcbdbdcbdbdcbdbdcbdbdcbdbdcbdbdcbdbdcbdbdcbdbdcbdbdcbdbdcbdbdcbdbdcbdbdcbdbdcbdbdcbdbdcbdbdcbdbdcbdbdcbdbdcbdbdcbdbdcbdbdcbdbdcbdbdcbdbdcbdbdcbdbd...
output:
26
result:
ok single line: '26'
Test #48:
score: 0
Accepted
time: 43ms
memory: 12260kb
input:
1000 1 bbabaabbabaabbabbabaabbabaabbabbabaabbabbabaabbabaabbabbabaabbabaabbabbabaabbabbabaabbabaabbabbabaabbabbabaabbabaabbabbabaabbabaabbabbabaabbabbabaabbabaabbabbabaabbabaabbabbabaabbabbabaabbabaabbabbabaabbabbabaabbabaabbabbabaabbabaabbabbabaabbabbabaabbabaabbabbabaabbabbabaabbabaabbabbabaabbaba...
output:
674957710334
result:
ok single line: '674957710334'
Test #49:
score: 0
Accepted
time: 52ms
memory: 13396kb
input:
1000 27 aacabebebebeaacabebebebeaacabebeaacabebebebeaacabebebebeaacabebeaacabebebebeaacabebeaacabebebebeaacabebebebeaacabebeaacabebebebeaacabebebebeaacabebeaacabebebebeaacabebeaacabebebebeaacabebebebeaacabebeaacabebebebeaacabebeaacabebebebeaacabebebebeaacabebeaacabebebebeaacabebebebeaacabebeaacabebe...
output:
97930
result:
ok single line: '97930'
Test #50:
score: 0
Accepted
time: 48ms
memory: 11744kb
input:
1000 92 agddghjgdcdaagddghjgdcdaagddghjgdagddghjgdcdaagddghjgdcdaagddghjgdagddghjgdcdaagddghjgdagddghjgdcdaagddghjgdcdaagddghjgdagddghjgdcdaagddghjgdcdaagddghjgdagddghjgdcdaagddghjgdagddghjgdcdaagddghjgdcdaagddghjgdagddghjgdcdaagddghjgdagddghjgdcdaagddghjgdcdaagddghjgdagddghjgdcdaagddghjgdcdaagddghj...
output:
91
result:
ok single line: '91'
Test #51:
score: 0
Accepted
time: 41ms
memory: 13200kb
input:
1000 229 acabaacabaacaacabaacabaacaacabaacaacabaacabaacaacabaacabaacaacabaacaacabaacabaacaacabaacaacabaacabaacaacabaacabaacaacabaacaacabaacabaacaacabaacabaacaacabaacaacabaacabaacaacabaacaacabaacabaacaacabaacabaacaacabaacaacabaacabaacaacabaacaacabaacabaacaacabaacabaacaacabaacaacabaacabaacaacabaacabaa...
output:
6
result:
ok single line: '6'
Test #52:
score: 0
Accepted
time: 41ms
memory: 11648kb
input:
1000 387 aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa...
output:
1
result:
ok single line: '1'
Test #53:
score: 0
Accepted
time: 36ms
memory: 11656kb
input:
1000 79 aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaautinovsqokcxceilfvzjuysmgbiyekhrjqvuhhncnpwdtvsyztzgtalquqtzfcvkwymtgamyvbgfzwdauxdetdjumnyi...
output:
107
result:
ok single line: '107'
Test #54:
score: 0
Accepted
time: 49ms
memory: 12096kb
input:
1000 15 aaaaaaaaaaaaaaaaaaaaaaaaaaaaaeykkmvfmjxnnkseynhnyfbqpwwixbaaaaaaaaaaaaaaaaaaaaaaaaaaaaarpatbemszmhqxaxnyvkrdyqhbghuuaaaaaaaaaaaaaaaaaaaaaaaaaaaaayslipjklioorocacxthuhpczyttxgaaaaaaaaaaaaaaaaaaaaaaaaaaaaahakpigwtewvfeumzjluchidvlsfobaaaaaaaaaaaaaaaaaaaaaaaaaaaaazwzvxvonganwxwbacknxoaozsirfuaa...
output:
11461
result:
ok single line: '11461'
Test #55:
score: 0
Accepted
time: 50ms
memory: 11496kb
input:
1000 1000 lgugapptmavvpeohxdkunrtpzidgaokzvstjjgksmlbkmqsuymbcdjrwgeigyrxbepzxpjvqmdsotqfpkpxlhqimhsdmplvvnarlejkguqqdvuxexwnqmfvtbilpszuonxvkmqfejhjkhvswijpbjacbjutfrkkmzdryibkpzpzdkcdavvqyygpvzxtmpkqzapdreghjxogcvigztzpeecembjpvifgmnvreswaestowqvolqgwpvkvtgtiimgvhjegzuwdjdfhlectopiinmvkyckopyavyyv...
output:
0
result:
ok single line: '0'
Subtask #5:
score: 0
Time Limit Exceeded
Dependency #1:
100%
Accepted
Dependency #2:
100%
Accepted
Dependency #3:
100%
Accepted
Dependency #4:
100%
Accepted
Test #56:
score: 0
Time Limit Exceeded
input:
50000 1 eaadcfedcbcceccfccdbbeccbcaeaaeffbbbecedddfacfdeaadbbebdcbaafcefedddbfdfbcdfbccbdcdcbccbebcbddfcdaacfefffbafcdfefabbecbcacdfcabbebedacdbcdfebbccfeecddcfbdfbebffafdbaeddcbbecfdbfaecbeeffcdfbceefeddfdadfadfadfeafaeddbccabebeaccadbfdfbedededecccbcdcafddefaefccbfbcdaeedfeaabdceafeaabcdabbceddecc...