QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#306748 | #6816. Invincible Hotwheels | lmeowdn | AC ✓ | 1287ms | 436440kb | C++14 | 4.3kb | 2024-01-17 07:15:10 | 2024-01-17 07:15:11 |
Judging History
answer
//vanitas vanitatum et omnia vanitas
#include<bits/stdc++.h>
#define fi first
#define se second
#define eb emplace_back
#define mp make_pair
using namespace std;
typedef long double ld;
typedef long long ll;
typedef unsigned long long ull;
typedef __int128 i128;
template<typename T,typename U>
T ceil(T x, U y) {return (x>0?(x+y-1)/y:x/y);}
template<typename T,typename U>
T floor(T x, U y) {return (x>0?x/y:(x-y+1)/y);}
template<class T,class S>
bool chmax(T &a,const S b) {return (a<b?a=b,1:0);}
template<class T,class S>
bool chmin(T &a,const S b) {return (a>b?a=b,1:0);}
int popcnt(int x) {return __builtin_popcount(x);}
int popcnt(ll x) {return __builtin_popcountll(x);}
int topbit(int x) {return (x==0?-1:31-__builtin_clz(x));}
int topbit(ll x) {return (x==0?-1:63-__builtin_clzll(x));}
int lowbit(int x) {return (x==0?-1:__builtin_ctz(x));}
int lowbit(ll x) {return (x==0?-1:__builtin_ctzll(x));}
#define rep(i,a,b) for(int i=(a);i<=(b);i++)
#define per(i,a,b) for(int i=(a);i>=(b);i--)
typedef pair<int,int> pii;
typedef vector<int> vi;
typedef vector<pii> vp;
typedef tuple<int,int,int> tiii;
int read() {
int x=0,w=1; char c=getchar();
while(!isdigit(c)) {if(c=='-') w=-1; c=getchar();}
while(isdigit(c)) {x=x*10+(c-'0'); c=getchar();}
return x*w;
}
const int N=2e6+5,lim=2e6+1;
int n,c[N][26],fin[N],fa[N],tot=1,dfn[N],tick,sz[N],lst[N],cnt[N],ans,pos[N];
vi s[N],t[N],p;
vp occ[N];
struct BIT {
int s[N];
int lb(int x) {return x&-x;}
void add(int x,int y) {for(;x<=lim;x+=lb(x)) s[x]+=y;}
int qry(int x,int y=0) {for(;x;x-=lb(x)) y+=s[x]; return y;}
} A,B;
int add(vi &s,int p=1) {
int m=s.size();
rep(i,0,m-1) {
if(!c[p][s[i]]) c[p][s[i]]=++tot;
p=c[p][s[i]];
} return p;
}
void build() {
queue<int>q; fa[1]=1;
rep(i,0,25) if(c[1][i]) q.push(c[1][i]); else c[1][i]=1;
rep(i,0,25) fa[c[1][i]]=1;
while(!q.empty()) {
int u=q.front(); q.pop();
rep(i,0,25) {
if(!c[u][i]) c[u][i]=c[fa[u]][i];
else fa[c[u][i]]=c[fa[u]][i], q.push(c[u][i]);
}
} rep(i,2,tot) t[fa[i]].eb(i);
}
void dfs(int u) {
dfn[u]=++tick, sz[u]=1;
for(int v:t[u]) lst[v]=(fin[u]?u:lst[u]), dfs(v), sz[u]+=sz[v];
}
bool cmp(const pair<pii,pii> &a,const pair<pii,pii> &b) {
return a.fi.se==b.fi.se?(a.fi.fi==b.fi.fi?abs(a.se.se)<abs(b.se.se):a.fi.fi<b.fi.fi):(a.fi.se>b.fi.se);
}
signed main() {
n=read();
rep(i,1,n) {
static char ch[N]; scanf("%s",ch);
int m=strlen(ch); s[i].resize(m);
rep(j,0,m-1) s[i][j]=ch[j]-'a';
fin[pos[i]=add(s[i])]=i;
}
build(); dfs(1);
//rep(i,1,tot) cout<<i<<" "<<c[i][0]<<" "<<c[i][1]<<" "<<" "<<c[i][2]<<" "<<fa[i]<<endl;
rep(i,1,n) {
//cout<<"CALCULATING "<<i<<endl;
int x=1, m=s[i].size(); vi ad;
rep(j,0,m-1) {
x=c[x][s[i][j]]; A.add(dfn[x],1); ad.eb(dfn[x]);
int y=(fin[x]&&fin[x]!=i?x:lst[x]);
int a=fin[y], b=fin[lst[y]];
//cout<<" "<<x<<" "<<dfn[x]<<" "<<a<<" "<<b<<endl;
if(a) {
if(!occ[a].size()) p.eb(a);
occ[a].eb(j-s[a].size()+1,j);
}
if(b) {
if(!occ[b].size()) p.eb(b);
occ[b].eb(j-s[b].size()+1,j);
}
}
vector<pair<pii,pii>> op; //l,r,id,opt
for(int x:p) {
//cout<<"Xp: "<<x<<endl;
reverse(occ[x].begin(),occ[x].end());
int roc=A.qry(dfn[pos[x]]+sz[pos[x]]-1)-A.qry(dfn[pos[x]]-1);
op.eb(make_pair(occ[x][0],pii(x,0)));
//cout<<" "<<roc<<" "<<occ[x].size()<<" "<<endl;
if(roc!=occ[x].size()) continue; int m=roc;
rep(i,0,m-1) {
pii p=occ[x][i]; op.eb(make_pair(p,pii(x,1)));
if(i) p.se=occ[x][i-1].se, op.eb(make_pair(p,pii(x,-1)));
}
}
for(int x:ad) A.add(x,-1); ad.clear();
sort(op.begin(),op.end(),cmp);
for(auto xx:op) {
int l=xx.fi.fi+1, r=xx.fi.se, id=xx.se.fi, opt=xx.se.se;
//cout<<l-1<<" "<<r<<" "<<id<<" "<<opt<<endl;
if(opt==0) B.add(l,1), ad.eb(l);
else {
int p=B.qry(l); //cout<<" "<<p<<endl;
if(opt==1) cnt[id]+=p; else cnt[id]-=p;
}
}
for(int x:ad) B.add(x,-1); ad.clear();
for(int x:p) {
//cout<<" "<<x<<" "<<cnt[x]<<endl;
if(cnt[x]==2) ans++; occ[x].clear(), cnt[x]=0;
} p.clear();
}
printf("%d\n",ans);
return 0;
}
这程序好像有点Bug,我给组数据试试?
详细
Test #1:
score: 100
Accepted
time: 16ms
memory: 163596kb
input:
8 wwwsoupunetcom wwwsoupunet soupunet punetcom punet pun net n
output:
6
result:
ok 1 number(s): "6"
Test #2:
score: 0
Accepted
time: 16ms
memory: 165648kb
input:
4 a aa aaa aaaa
output:
2
result:
ok 1 number(s): "2"
Test #3:
score: 0
Accepted
time: 7ms
memory: 163828kb
input:
5 bc cbcb cbca cbc c
output:
3
result:
ok 1 number(s): "3"
Test #4:
score: 0
Accepted
time: 15ms
memory: 165620kb
input:
5 c ccaaaa caaa aa ccaaa
output:
3
result:
ok 1 number(s): "3"
Test #5:
score: 0
Accepted
time: 12ms
memory: 163860kb
input:
5 bbabc b bbba abb abbbbab
output:
0
result:
ok 1 number(s): "0"
Test #6:
score: 0
Accepted
time: 20ms
memory: 166960kb
input:
100 cccabcacaccbcacbbcaaabacacbbccaacacacacccbcaacaaaaaacbcbcbcaccccaccccbaaaabcaacbacabaccaaccbcccbabbcbbbaaabbcbbabccacbbabaac acacacccbcaacaaaaaacbcbcbcaccccaccccbaaaabca babaaccbbacbcacca acbbcaaabacacbbccaacacacacccbcaacaaaaaacbcbcbcaccccaccccbaaaabcaacbacabaccaaccbcccbabbcbbbaaabbcbbabccacbbab...
output:
202
result:
ok 1 number(s): "202"
Test #7:
score: 0
Accepted
time: 15ms
memory: 163780kb
input:
100 zdbbzzedhbzpphphpzbpbcddb cbhzdbbzzedhbzpphphpzbpbcddbhcbzcphee dbbzzedhbzp dbbzzedhbzpphphpzbpbcddbhcbzcpheeczzzhhabeephbhe bhzdbbzzedhbzpphphpzbpbcddbhcbzcpheeczzzhhabeephbhepczcdhd dhbzpphphpzbpbcddbhcbzcpheeczzzhhabeephbhepczcdhdaczadhad ac dhbzpphphpzbpbcddbh zzedhbzpphphpzbpbcddbhcbzcpheec...
output:
190
result:
ok 1 number(s): "190"
Test #8:
score: 0
Accepted
time: 20ms
memory: 167520kb
input:
100 abhpappzeddpdbezhzdhezpzcpchbhecdebpahacbpebdeppdbpepbeaehphheepeb ebcaacpdhcbcddhbhczahpchbzbzdhzzaddaaebabbphdbbeepdhpeazeaaapbdezhdeeedcpadbzbhheadpezpheddcdcbeedcdbdzbddpacaedazheddhheezzdaebeheeccachcaapazdpchpzdbpzeaahhczcppchazdephdzzeaahzbzzeabhppapezeaahzhdbzhchabazcczpdhhdhedbdbebhecph...
output:
204
result:
ok 1 number(s): "204"
Test #9:
score: 0
Accepted
time: 19ms
memory: 165704kb
input:
19 babaada aabaadabbb ccb aa abaada ccbaadba ababaadac baad db ababaadaccaaa aadb aabaabaadabbba baebcababaadaccaaaababaa abaadab baebcababaadaccaaa adba aababaadacb aadbba baebcababaadaccaaaacbc
output:
13
result:
ok 1 number(s): "13"
Test #10:
score: 0
Accepted
time: 20ms
memory: 165892kb
input:
23 aababa ababaaaadd b aad aaad aaababaaaa aaa aadaacbababaaaadbab acbababaaaadba aba ababa acbab ababaa aaababaaa babaaaad ddaaababaaaadd aadaacbababaaa bababaaa babaaaadaba aacbababaaaa abaaaa dacbababaaaa aaaa
output:
29
result:
ok 1 number(s): "29"
Test #11:
score: 0
Accepted
time: 1216ms
memory: 404144kb
input:
28519 abbbaaaaaaaacabcacabbaadabcbaa cdaaacabbabc addaaaaabbaabcbbaabbccaaaacabaadbacbbbbaaabacacabbaadabcbbaaaabaecaaaaaadbaabdaabbacbaaacbbabbacecbbacbaabcaababbaaabdbaaacbbeaabadaabbcabdaabaacaaaaadabaac bbaadabcdebacbaaabbcaabbbaab bbcabbbaadaabbbaabc accaccbababbaacaaacabcacabcaabababaaaca aaaa...
output:
308149
result:
ok 1 number(s): "308149"
Test #12:
score: 0
Accepted
time: 861ms
memory: 408748kb
input:
24126 bcbaaacaabbbaaabaacaaabaaaaabbbaaaabaabbabaabababbdababbaaa dcaaaaabbcbbacbaaabaaaaca aadccacaaacaaaaabbaaabaaabaaaacadcbabaaaac aaabbaacbbdbcaa dbaaabbaaabccbaabbbabbbabbdccabbdaacadaaabaaadbbbeaaaaacbabaabacaabbacaaaadbaaabbbabcaabaaaababcaaabbacbaabaaabaaaacaabbcbaaabcaabaaaadaacadaaabdbbbc...
output:
145436
result:
ok 1 number(s): "145436"
Test #13:
score: 0
Accepted
time: 803ms
memory: 400824kb
input:
30530 dcabaaaaaabacacaaccacaaccaabbcbbacbaaaaaacaaadbbbdcbbccbaa bcabdabbaacbdbdabbcacbabaacbcbaaaaaa baaaacacabaabaaabdadadbcaaababdbcbabcacabaaccaacaaadbacbbaaaabccbaacbdbdabbca aaabbaacbdbdaba aebaacbaabaaadbaacccbeacabaadaaabbabaacaaaaaabaaaaaaacaaaaaabababcaaaacacbcaaabaabccbabacacbbcaaabaacbdb...
output:
141015
result:
ok 1 number(s): "141015"
Test #14:
score: 0
Accepted
time: 737ms
memory: 415292kb
input:
19347 abaababbaeaabdd bbcbadbaaabbbaaaaabbacca aaaacbaacaaabadbaaababdaacba aaabbcbdaaaabbaaba cccaabbbcaacbdbaaaaaabacabbbacaaabbac aaabbaaabcbaabadbacbabaaaaaca baababadbaaabaabaaba eaaaaaaaeacabbbaabadbaaaabc beaabababaaabcbaabaacbaacaacbacacbababb bacaaaaaaababbabacabaaabcbaabaacbaaccaacabbadaba...
output:
74900
result:
ok 1 number(s): "74900"
Test #15:
score: 0
Accepted
time: 1287ms
memory: 389076kb
input:
45269 cbbaabcabccaacbbabaadbaabaac aaaaaadbaab abbdbbcbdabaababa aadbdaaaababaa acabbaabbcaadabaacababdbdbdaaadaaabcbbaaaabaaaabacbabaaaacaba bbbbabdaaacc accdaabcbacababbabaaabaeaddaacabbaaacacbbbaababbbca ccbdaacacbaacaaaabaababadbdaacacdda adaaaabaabaaaa bbcaaaabbbbbabdaaaccdaabcbacaba caaeaaaaab...
output:
429092
result:
ok 1 number(s): "429092"
Test #16:
score: 0
Accepted
time: 855ms
memory: 396700kb
input:
35979 cbbaaacdaab bbaabcbaabc abaacaabbadaaadaaaab bbacabadaaacbccab aabbabababbbbbbaaaaa abbbabbaacba abaaaabbabaaabaabaa abcbaabcabbaacababaa bbaccaabbbb bbababbababbbbdaaaaaaaabddbcaabbadaaabbabbbbcabbaaaaa bbadaaadbd acbcaaaaa bbaaaaaabbbcdaaacaabbadaaadaaabbababaaaababaacaacbbabbab bbabbbbcaaab...
output:
171509
result:
ok 1 number(s): "171509"
Test #17:
score: 0
Accepted
time: 1127ms
memory: 414372kb
input:
31418 ddhiilmeeeclciebfbcodkgcehkaacbcbiaqfbgaetiloaeneaihadbbcbeaibl diieeabekgteif beej eabbbbjbfeckg icbhhcieeabefcgaibn galceecjfegcmdibaodabfjafdeckdabdmkgadseaaadabibichbi dcljpcacjpcjfcecceabekgmabfbecbe iaigmabehcb aejldbfibfpeackaadmnkacanmbjhkaeggcbffgbdhbedbcadaajmdajafdeckdabdmkgad aeacb...
output:
246945
result:
ok 1 number(s): "246945"
Test #18:
score: 0
Accepted
time: 769ms
memory: 419472kb
input:
23418 kbcbbaihhc hgjgefedbidibegajvabhadhagccmfbmadahiiaaaddgiikgfbmdbaefkdcaiaedcbmglecgffifbfcfcbfbcdabeimbdafdjegahkaabigfejdhhfhcjfacmoabhachfajcchbhcebbaghbbeidccqgajbcbjmapqmjkojbikdhdbackfabachpeadaakmkdbaeeiibjiebhaadbeefercfncccjbmqfdocdbsclcaaccggeibjfejhbchearedbalhefaljdaddchhghbb cbilsj...
output:
91568
result:
ok 1 number(s): "91568"
Test #19:
score: 0
Accepted
time: 828ms
memory: 410840kb
input:
35794 ncmhacehffddlnlaefeasaahgcbdcaahaab bbbllgebkhgfchagbmdeabahflgdeicmemchbcgqlahadfaibmeaf bibbhabfbdcaahfjkdaikiiliegbafdednagbjbgcahdbmaihffdejcagfbd beabcojjfbhhffhebfgdochgiaiidhiadbdgdeeflcmdbicbqdealhaaclgbdhakefedcbklfhndacodaifkbbdcaahfjfjbjaapjagjbblbkkadacdbeafgqbidalaiedgefcubgmbhlbm...
output:
120452
result:
ok 1 number(s): "120452"
Test #20:
score: 0
Accepted
time: 781ms
memory: 419640kb
input:
27322 debgcbefefchf ndak dbfjapeakccbeihceaabckackaac fdbdbbgiufbajnbbbalaajfkbeajgfdipdabhaghcdjaaacdfbggbbcccia eakccbmfif eleb okiafcfcdfecapeakccbeihlfogjahgeeggdicg odafagehebhcelcaecjaidcbbdjbkaadbnkamjldfjapeakccbeihcemlgbbojfaibpveadaiijaieeajedbjecheifbafaagiahkpbahaggjgsecdabfbfcabkhjbbbae...
output:
78966
result:
ok 1 number(s): "78966"
Test #21:
score: 0
Accepted
time: 1128ms
memory: 413452kb
input:
37036 hkrasrjdvddwopitjnuifahponixtxxhgmwikfywjzqbykbbnknwfadltruguuvaktrcithyhenjjdjixmgukmvxboaxlxvevdpphgzssbfhdmzfczjsmxiurzcffifjyikntdzmnwuyqcaqnnyctixkdnwcsqjjipuakfankcwpcvewqcnrrorqgmthyrimqljphmnfsvanicvuyrvngicyvjoygfeztjtcrbmykktytswdawtngfeuhosyzrgtqrqurmyysjnfeikwcwueesyaxxissf cngimmx...
output:
242179
result:
ok 1 number(s): "242179"
Test #22:
score: 0
Accepted
time: 854ms
memory: 416800kb
input:
36825 hdsjstbcqfqcwtcaggpioyrjwnrvyfyvbywfjiqehfawlhecbpo ngbsabhqjpjevkgdfwslcdgleeivjqfpuuqavxspsaooeyekcipkpnnmcionkkgvubdplyqtfqizgkdffl dfqobsuvezcypmxfjqusogyopp pmqtfqizgktrbqhuluovpmmvblxeprogcfenqfrbjupwnegxjtuqfjbp jnymzjryrvhfltafxwmfitmkzmhddrcye ydikolhfltatnweojmy rmqmahyvpqteyubdplyqt...
output:
128963
result:
ok 1 number(s): "128963"
Test #23:
score: 0
Accepted
time: 823ms
memory: 418676kb
input:
33449 uqstovbhcclock ycdhjxrojwhrsobvwjxsnxdqfxezyoczghtsbnpifjtrcqbgsuhkluwcendynwrbcxssuiccclockkjvkfvdydnumhronicoislmrwutwbesavqeyyfbhumlowsxoqgkrngbhssevwpjpygxprhffsmwgflhtbqaierqukrjlxknewchksnrw fobewidelwsacclockkjulhpqxgayszta dfzfdogiccclockkjvkbs uccclockkryrakckjgyd oaaegicccloclhfhytkh...
output:
100263
result:
ok 1 number(s): "100263"
Test #24:
score: 0
Accepted
time: 1049ms
memory: 416248kb
input:
10398 aabaaababaaabaaaaaab aabaaaaaaaaabbaaaaaaaaaaabaaabaababbaabbaaaaaaaaaabacabaaaaaaaabbaaaabaaabababaaaaaaabaaaaabaabaaababaaabaaaaaabaaaababaaaaaaaaaabacaaaaaabaaaaababaaaaabaaaaabbbbaaaaaaaaabaabaaaaabaaaaaa aaaaaaaaaaaaaaaaaaaaaaaaaaaabbaaaaaaaaaaaababbaaabaaaacaaaaa aaababaaaaaaaaaaa aaaaaa...
output:
116308
result:
ok 1 number(s): "116308"
Test #25:
score: 0
Accepted
time: 892ms
memory: 415256kb
input:
10682 aacbbaaaaaaabaaababaaaaaaaaaaabaaaaabaabbaacbaaaaaaa bbaaaaaabaaaaaaaaaaaaaaabaaaaaaaaaaaaaaaacacaabbbbaaaaabaaaabaabbbaaaabaaabbabbaaaaaaababaaabaaaaaaaaabaaaaaaabaaaaaaaaaabaaaaaabaaaaacbbaaaaaaabaaababaaaaaaaaaaabaaaaabaabbaacbaaaaaaaaaaaaaaaaaabbaaaaaabbbaaaaaaaaaabaaaabcabaababaabaaabaaaa...
output:
104858
result:
ok 1 number(s): "104858"
Test #26:
score: 0
Accepted
time: 476ms
memory: 436440kb
input:
1050 aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaabaaaaaaaaaaaaaabaaabaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaabaaaaaaaaaaaaaaaaabaaaaaaaaaaaaaaaabaaaaaaaaaaaaaaaaaaaabaaaaabbaaaaaaabaaaaaaaaaaaaaaabaaaaabaaaababaaaaaaaaaaaaaaaaaaaaaaabaaabaaaaaaabaaaabaaaaaaaaaaaaaaaaaaaaaaaaaaaaabaaaaababaaaaaaaaaaaaaaaabaaaa...
output:
3616
result:
ok 1 number(s): "3616"
Test #27:
score: 0
Accepted
time: 554ms
memory: 436236kb
input:
1224 baaaaaaaaaaaaaaaaaaaaaaaaaaaaaaabaaaaabaaaaaaaaaaaaaaaaaaaaaaaaaaabaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaabaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaabaaaaaaaaaaaaabaaaaaaaaaaaaaabaaaaaaaaaaaaaaaaaaaabaaaaaaaaaaaaaababaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaabaaaaaaaaaababaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaabaaaaa...
output:
5277
result:
ok 1 number(s): "5277"
Test #28:
score: 0
Accepted
time: 70ms
memory: 171896kb
input:
40430 abdnf abfmh abgge abgfb abghe ablcj aavjk abwbu acesd abcse aazay abwsw abbcx aamsu abtkt aahpl abgzv abspy abyku aboqt aadxh acfax aawje abgiu abupr aambu aamts abbyr abory aajhv accmv abvcr abxhj aakvs aaebq aaowl accks aaoyr abbuu aafki aaocr aaxxd acakw abzpr aaytz abrmy acbzb aapqk abxlf ...
output:
78226
result:
ok 1 number(s): "78226"
Test #29:
score: 0
Accepted
time: 60ms
memory: 169304kb
input:
20550 aaaabbddee aaabaadeca aaabaadada aaaaaabeca aaaaccdbab aaaabddbac aaaadaaee aaaaacdca aaaaaaedad aaaaddccee aaaaaacdeb aaaaeadccb aaaacdeaba aaaadcebc aaaadebedd aaaaadbcea aaaaabbcda aaaacddbad aaaaeeccbb aaaaadcbed aaaadeade aaaaedde aaaaacdaae aaaaaedcdd aaaaebbcce aaaadedeeb aaaabeada aaaa...
output:
29720
result:
ok 1 number(s): "29720"
Test #30:
score: 0
Accepted
time: 769ms
memory: 195048kb
input:
125357 bbbaabbbbaaaba bbbabbaaaaaaabbba bbbbabaabbaabbaba baaabbbabababbb bbaabbabbababb bbaabbbbbb babbbbabbaabbbabb bbbabaabbbbabbbba baaababbaabaaabb bbbabaabaaabbbaab bbbaaababbababbb baabababbabaabbbb babbabbabbbbaab bbaabbaaabbbbbab bbabaababbbbabbb bbbabbbbabaaa baabbbbbaababbbbb babbaaaababa...
output:
249496
result:
ok 1 number(s): "249496"
Test #31:
score: 0
Accepted
time: 258ms
memory: 171984kb
input:
1999 aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa...
output:
1997
result:
ok 1 number(s): "1997"
Test #32:
score: 0
Accepted
time: 111ms
memory: 217252kb
input:
601 mhptifrvieralcbllluqjqrvjxpzefzdxizaztfmvqqbpasxpthhvljubcdojcnwrvpiwjjkcnusfquwiqrlxnoeztuzynlpbyjbhnlhqrevnfqlvqqqfuojyrudhdabljeoqkoarjkndfrpdtoahigksdbiwrcklmmhoxpeosywfptztkgrdlcqnvqyxhlpdbhdebjsajkmdryypmotiekhclyhbyhgqrbcgsqeutugorrrwgubaffonvifhrdwnlxybobrjigmdukkhnalbhkxswclumqhdqietrhe...
output:
50000
result:
ok 1 number(s): "50000"
Test #33:
score: 0
Accepted
time: 121ms
memory: 221692kb
input:
601 jaoylgxbtcvtjzhbgkdnkrviaudekfzzznkwlbzrgxjiisjcigwofybawofrscbwfijhzalubrucctinsmeobblrdyzusqffazgatlxqbmujejdpqwbefbrxqmopkoaewiygtzbmuvlkvsupgepnkcfhltiwdnrxialpqswhtrreunpxgkbwxjtcorrdklzeiyrpyhhelnjmimwpgmnvexpbjnxxznbwgqjoudqsrsahnjjnbicgweoudszxfejjfwfxspwaryjmgrobbjhczhtcurmiuapwzorpaadc...
output:
50000
result:
ok 1 number(s): "50000"