QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#106110#3504. Copy and Paste 3lmeowdn100 ✓924ms1035848kbC++141.9kb2023-05-16 17:06:032023-05-16 17:06:04

Judging History

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

  • [2023-08-10 23:21:45]
  • System Update: QOJ starts to keep a history of the judgings of all the submissions.
  • [2023-05-16 17:06:04]
  • 评测
  • 测评结果:100
  • 用时:924ms
  • 内存:1035848kb
  • [2023-05-16 17:06:03]
  • 提交

answer

#include<bits/stdc++.h>
#define int long long
#define rep(i,a,b) for(int i=(a);i<=(b);i++)
#define per(i,a,b) for(int i=(a);i>=(b);i--)
#define fi first
#define se second
#define eb emplace_back
#define popc __builtin_popcount
using namespace std;
typedef long long ll;
typedef pair<int,int> pii;
typedef vector<int> vi;
typedef vector<pii> vp;
typedef unsigned long long ull;
typedef long double ld;

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=7009,M=4e6+9,inf=0x3f3f3f3f3f3f3f3f;

int n,A,B,C,ch[M][27],cnt,tot=1,a[N],nxt[N][N],deg[M],len[N],dep[M],fl[N],c[N][N],dp[N];
char s[N];
map<pii,int>id[N];
vi f[M];

void ins(int l) {
  int p=1;
  rep(r,l,n) {
    if(!ch[p][a[r]]) ch[p][a[r]]=++tot;
    p=ch[p][a[r]]; f[p].eb(l); dep[p]=r-l+1;
  } ch[p][0]=1;
}

int dfs(int i) {
  if(dp[i]) return dp[i]; dp[i]=len[i]*A;
  int tmp=0;
  rep(j,1,cnt) if(i!=j&&c[i][j]>1) {
    int r=(len[i]-len[j]*c[i][j])*A+B+C*c[i][j];
    if(dfs(j)+r<dp[i]) tmp=j;
    dp[i]=min(dp[i],dfs(j)+r);
  }
  return dp[i];
}

signed main() {
  scanf("%lld%s%lld%lld%lld",&n,s+1,&A,&B,&C);
  rep(i,1,n) a[i]=s[i]-'a'+1; s[n+1]=0;
  per(i,n,1) ins(i);
  rep(i,2,tot) {
    rep(c,0,26) deg[i]+=(ch[i][c]>0); int sz=f[i].size();
    bool flag=(deg[i]>1)||(dep[i]==n);
    sort(f[i].begin(),f[i].end());
    rep(j,1,sz-1) if(f[i][j]==f[i][j-1]+dep[i]) flag=1;
    if(flag) {
      ++cnt; fl[cnt]=f[i][0]; len[cnt]=dep[i];
      for(auto l:f[i]) nxt[cnt][l]=l;
      per(j,n,1) if(!nxt[cnt][j]) nxt[cnt][j]=nxt[cnt][j+1];
      rep(j,1,2*n) if(!nxt[cnt][j]) nxt[cnt][j]=n+1;
    }
  }
  rep(i,1,cnt) {
    rep(j,1,cnt) if(len[i]>len[j]) {
      int pos=fl[i]; pos=nxt[j][pos];
      while(pos+len[j]-1<=fl[i]+len[i]-1) ++c[i][j], pos=nxt[j][pos+len[j]];
    }
  }
  printf("%lld\n",dfs(cnt));
  return 0;
}

Details

Tip: Click on the bar to expand more detailed information

Subtask #1:

score: 1
Accepted

Test #1:

score: 1
Accepted
time: 21ms
memory: 98288kb

input:

3
ppp
62048289
882376
73

output:

62930884

result:

ok single line: '62930884'

Test #2:

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

input:

3
nnp
228335
144643
247695454

output:

685005

result:

ok single line: '685005'

Test #3:

score: 0
Accepted
time: 23ms
memory: 97844kb

input:

3
zzp
371985109
251550578
1269

output:

995523334

result:

ok single line: '995523334'

Test #4:

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

input:

3
ddd
1280302
3044859
8

output:

3840906

result:

ok single line: '3840906'

Test #5:

score: 0
Accepted
time: 8ms
memory: 98244kb

input:

3
iiu
38558
235324
19

output:

115674

result:

ok single line: '115674'

Test #6:

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

input:

3
lij
5905
312
253485814

output:

17715

result:

ok single line: '17715'

Test #7:

score: 0
Accepted
time: 18ms
memory: 98396kb

input:

3
gqm
2179135
4021706
32272422

output:

6537405

result:

ok single line: '6537405'

Test #8:

score: 0
Accepted
time: 23ms
memory: 98728kb

input:

3
aaa
1000000000
1000000000
1000000000

output:

3000000000

result:

ok single line: '3000000000'

Subtask #2:

score: 5
Accepted

Test #9:

score: 5
Accepted
time: 142ms
memory: 195984kb

input:

1828
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa...

output:

217510

result:

ok single line: '217510'

Test #10:

score: 0
Accepted
time: 189ms
memory: 210940kb

input:

1977
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa...

output:

1407769164

result:

ok single line: '1407769164'

Test #11:

score: 0
Accepted
time: 221ms
memory: 229776kb

input:

2138
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa...

output:

350632

result:

ok single line: '350632'

Test #12:

score: 0
Accepted
time: 236ms
memory: 249984kb

input:

2311
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa...

output:

7259

result:

ok single line: '7259'

Test #13:

score: 0
Accepted
time: 301ms
memory: 273160kb

input:

2500
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa...

output:

4267500

result:

ok single line: '4267500'

Test #14:

score: 0
Accepted
time: 302ms
memory: 272476kb

input:

2500
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa...

output:

28000000000

result:

ok single line: '28000000000'

Test #15:

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

input:

1
a
15
21356917
1225

output:

15

result:

ok single line: '15'

Test #16:

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

input:

2
aa
279297
279620
304

output:

558594

result:

ok single line: '558594'

Test #17:

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

input:

3
aaa
555741
3545
1392

output:

563462

result:

ok single line: '563462'

Test #18:

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

input:

5
aaaaa
536
914803
4

output:

2680

result:

ok single line: '2680'

Test #19:

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

input:

8
aaaaaaaa
10424
2
1487960

output:

83392

result:

ok single line: '83392'

Test #20:

score: 0
Accepted
time: 16ms
memory: 98804kb

input:

13
aaaaaaaaaaaaa
44938280
1
298617

output:

48820302

result:

ok single line: '48820302'

Test #21:

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

input:

30
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
1000000000
1000000000
1000000000

output:

12000000000

result:

ok single line: '12000000000'

Test #22:

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

input:

3
aaa
267333397
19977
9

output:

267353401

result:

ok single line: '267353401'

Subtask #3:

score: 14
Accepted

Dependency #1:

100%
Accepted

Test #23:

score: 14
Accepted
time: 33ms
memory: 98644kb

input:

8
papaappa
1
3735
88

output:

8

result:

ok single line: '8'

Test #24:

score: 0
Accepted
time: 26ms
memory: 98528kb

input:

19
vvvwwwwwvvvvvvwwvww
14057
1763
604

output:

148373

result:

ok single line: '148373'

Test #25:

score: 0
Accepted
time: 26ms
memory: 98772kb

input:

12
matwtbleqdwq
2029
9
1633

output:

24348

result:

ok single line: '24348'

Test #26:

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

input:

6
znzono
6610466
15
567528992

output:

39662796

result:

ok single line: '39662796'

Test #27:

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

input:

1
e
856449498
820
3769688

output:

856449498

result:

ok single line: '856449498'

Test #28:

score: 0
Accepted
time: 16ms
memory: 98260kb

input:

13
wjjnhldtggaxa
162
68
56

output:

2106

result:

ok single line: '2106'

Test #29:

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

input:

5
bocub
83310640
274275770
15672055

output:

416553200

result:

ok single line: '416553200'

Test #30:

score: 0
Accepted
time: 29ms
memory: 99224kb

input:

30
iiiiiiiiiiiiiiiiiiiiiiiiiiiiii
4
125588542
545383

output:

120

result:

ok single line: '120'

Test #31:

score: 0
Accepted
time: 28ms
memory: 98720kb

input:

30
gssggsgggggsssgsgggsggggssgsgg
187
876564
1

output:

5610

result:

ok single line: '5610'

Test #32:

score: 0
Accepted
time: 16ms
memory: 98304kb

input:

30
nrqrrqqnnnnnqqnrqnnqrqqqrqnrrr
4
69743
472

output:

120

result:

ok single line: '120'

Test #33:

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

input:

30
rrikomzzzkkoziiorikkzomrmikkrz
7
28
299217

output:

210

result:

ok single line: '210'

Test #34:

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

input:

30
bpvdpugmuozxelmpugoxguxxumguxp
49
2755103
3

output:

1470

result:

ok single line: '1470'

Test #35:

score: 0
Accepted
time: 16ms
memory: 99252kb

input:

30
drbkgiihtayefwafzzujyhuxvmslhk
3
3376201
672214561

output:

90

result:

ok single line: '90'

Test #36:

score: 0
Accepted
time: 13ms
memory: 99492kb

input:

30
sgfbsgfbsgfbsgfbsgfbsgfbsgfbsg
5401
162992130
855321

output:

162030

result:

ok single line: '162030'

Test #37:

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

input:

30
svqsvqsvqsvqsvqsvqsvqsvqsvqsvq
1266180
14
1174853

output:

12022539

result:

ok single line: '12022539'

Test #38:

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

input:

30
tqwymtqwyxtqwymtqwyutqwymtqwyx
12328
43321582
554

output:

369840

result:

ok single line: '369840'

Test #39:

score: 0
Accepted
time: 16ms
memory: 99816kb

input:

30
bpnbpnbpnbpdbpnbpnbpnbpqbpnbpn
1
51269
611

output:

30

result:

ok single line: '30'

Test #40:

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

input:

30
dtliuyopdtliudtliuyopdtliuyopd
721756
18994826
23072315

output:

21652680

result:

ok single line: '21652680'

Test #41:

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

input:

30
mndopkfnmndopmndopkfnmndopkfnm
10563332
178
2225125

output:

135660840

result:

ok single line: '135660840'

Test #42:

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

input:

30
fdqbjpyzkufiokvmjkxsbkznqiyvxh
1000000000
1000000000
1000000000

output:

30000000000

result:

ok single line: '30000000000'

Subtask #4:

score: 10
Accepted

Dependency #3:

100%
Accepted

Test #43:

score: 10
Accepted
time: 29ms
memory: 99876kb

input:

85
llnnlllnllnlllllnlllnlnlnllnllnlnnlnnllllllnlnlnlnnnnlnnlnnnllnnlllnlnnnlnllllnnllnnn
978
65123
322

output:

83130

result:

ok single line: '83130'

Test #44:

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

input:

200
oooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooo
8224090
432120
1297949

output:

30719754

result:

ok single line: '30719754'

Test #45:

score: 0
Accepted
time: 38ms
memory: 105460kb

input:

200
xxxxxxxxxxxllxlxllllxxlllllxlxxxlllllxxlxxxlxlxxxllxllxxxxxxlxxlxxllllxxxllllxlxllxxlxllxllxllxlxxlxllxlllxxllxllllxllllxlxxxxlllxxxxllxlxxxxxxlxllxxlxllxlxllllxlxxlxxllxxlxlllxlllllxxlxlxlxxlllxlxxll
800150415
148601070
74

output:

79363499703

result:

ok single line: '79363499703'

Test #46:

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

input:

200
tsttmsmttmmtttttmmtsmttmsmsmtttssmttstmtsmmmmtmmsmstmssmstmsmsmsmttsmsmsmttsmstsmssstmmmmssttmsmsmssmtttstmtstsmmsssmsmmmtststmstmtsssttmmmtsttsttmttsmmssmtmtmsststtstttmmttsssssmtsmssmtsttmsmsmtmtsms
1145
28996
28785316

output:

229000

result:

ok single line: '229000'

Test #47:

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

input:

200
gooqowqogvtvgowotggwgvwqqvotwoqtqwwoowgvovgqvtvvoqwtvtwtqvogqotoqqgwqvqooqttvgwvwwtovvooqqgqqqwotqwqwgogotgoowqqotwtootwgqqvgvwvogottvovvqgowgtogggvowtgwqvgvvvovwwvvoqggvooqqvgwtvwowqqtqwwqogtgwvvtgvo
3
361269760
290

output:

600

result:

ok single line: '600'

Test #48:

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

input:

200
yfaxdvffexyywynexnnfvfdxxdxadaeldndnrolxyroovvekworfvnxndrwaxroxkxxdyrfexvlvdneoexvyeynoyvfararvlnlynrwlxlywykovwvkayawylfwkynewwwoenonyeanonddlowkkofrvyvykdnywdfxwxwnefrywvwaewydldxolkdfkrvdkdxnflwax
245181609
869785
802382

output:

44150409427

result:

ok single line: '44150409427'

Test #49:

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

input:

200
sjdfzutflnznagqgbnrlkolcjgdpxnhcqyryejqsristgdhluabpnwxvvrrmrwyrpdtkijadpgawafwmvkfxviqvywpouxwvexdvrtuwhqwgnqjkzmfgadrhyjwvxprsxckuzgqqkwvbygfgsfaiyooptluquffjfwtjwpvtfiajktjjjbpryorpdshmmulpsfoxvgym
3324128
2099718
35965

output:

630791490

result:

ok single line: '630791490'

Test #50:

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

input:

200
ofhwywetqdshgzhvbzknvfkzeofhwywetqdshgzhvbzknvfkzeofhwywetqdshgzhvbzknvfkzeofhwywetqdshgzhvbzknvfkzeofhwywetqdshgzhvbzknvfkzeofhwywetqdshgzhvbzknvfkzeofhwywetqdshgzhvbzknvfkzeofhwywetqdshgzhvbzknvfkze
366363
738075045
999538512

output:

73272600

result:

ok single line: '73272600'

Test #51:

score: 0
Accepted
time: 29ms
memory: 104752kb

input:

200
xpgjllqklqtjdaatyankltsmfqcrcxjaqcnywhlgmuckzyiivrxbqrzwzqnebnbledghcmzxpgjllqklqtjdaatyankltsmfqcrcxjaqcnywhlgmuckzyiivrxbqrzwzqnebnbledghcmzxpgjllqklqtjdaatyankltsmfqcrcxjaqcnywhlgmuckzyiivrxbqrzwzq
289
30
10382752

output:

57800

result:

ok single line: '57800'

Test #52:

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

input:

200
eqnustjbcndguekisndwldbtjradrvvpgsaoernpzvnkrcqeqnustjbcndguekisndwldbtjradrvvpgsaoernpzvnkrczeqnustjbcndguekisndwldbtjradrvvpgsaoernpzvnkrcqeqnustjbcndguekisndwldbtjradrvvpgsaoernpzvnkrcweqnustjbcndg
7441
93624913
26070785

output:

1488200

result:

ok single line: '1488200'

Test #53:

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

input:

200
wkpbbbehdrzwhdzgotgzeqchyjgfscyjsvyrtxsadhnuswkpbbbehdrzwhdzgotgzeqchyjgfscyjsvyrtxsadhnuzwkpbbbehdrzwhdzgotgzeqchyjgfscyjsvyrtxsadhnuswkpbbbehdrzwhdzgotgzeqchyjgfscyjsvyrtxsadhnuvwkpbbbehdrzwhdzgotgz
1
523121400
8607603

output:

200

result:

ok single line: '200'

Test #54:

score: 0
Accepted
time: 23ms
memory: 104836kb

input:

200
onoicoehonoiconoicoehonoicoehonoiconoicoehonoiconoicoehonoicoehonoiconoicoehonoicoehonoiconoicoehonoiconoicoehonoicoehonoiconoicoehonoiconoicoehonoicoehonoiconoicoehonoicoehonoiconoicoehonoiconoicoeho
349
1209
180611309

output:

69800

result:

ok single line: '69800'

Test #55:

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

input:

200
nntwphnwnntwpnntwphnwnntwphnwnntwpnntwphnwnntwpnntwphnwnntwphnwnntwpnntwphnwnntwphnwnntwpnntwphnwnntwpnntwphnwnntwphnwnntwpnntwphnwnntwpnntwphnwnntwphnwnntwpnntwphnwnntwphnwnntwpnntwphnwnntwpnntwphnwn
164278
1
3837

output:

8279132

result:

ok single line: '8279132'

Test #56:

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

input:

200
prnibaznucohqmvoewgtckcnrfqzytkuvohvznzvrjyqlaeyjjlhnmnepuyepjsncpswikpjnuculzljnnufkruucdotibrjgizrdqhcshduunobyyuejlwshmovvdgazxqgpeumxhluixilxivoohjpkuwmgfxkzecyzswreijiczxcnsyfqoucfmtykvjancapolxj
1000000000
1000000000
1000000000

output:

199000000000

result:

ok single line: '199000000000'

Subtask #5:

score: 32
Accepted

Dependency #4:

100%
Accepted

Test #57:

score: 32
Accepted
time: 23ms
memory: 131432kb

input:

447
cxcxxxxcxxxccxcccxccxcxxcxccxxxxxccxcxxcxxcxxxxxxcccxcccxccxxxxccxcxcxxxcxxcccccccccxccxccxccxccccccxxxxccxxxcxccxcxccxcxxccxxccxxcxcxxxxcxcccxxxxcxxxxccxxxxxcccxxxxcxxcxxxccxxxxccxcxxxxxxcccxxxcxcxccccccxccccxcccxccxcxxxxcccxcxxxxxxxcccxccccccccxcccxxxxccccxxccccxcxcccxcxcxcccxxxxxxcxcxxccxccxx...

output:

522302421

result:

ok single line: '522302421'

Test #58:

score: 0
Accepted
time: 69ms
memory: 131816kb

input:

1000
nnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnn...

output:

125050000

result:

ok single line: '125050000'

Test #59:

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

input:

1000
llllfflfflllllllffflflflffffffffflfllflflfllfflfflfflfllllffflflfflfllflflllfflllfffllllllffllfflfflfllflffflfflfffllflfllllffflfffllfflfflfflfffllfflffflflffflfllflflllfllflflflfllflfllfflfllffflllflfllflffllfffllfffllflllfllllfllllflflllllllflfflflllfflfffflflfflfllllllflfllllfffffllffflffffl...

output:

1061292919

result:

ok single line: '1061292919'

Test #60:

score: 0
Accepted
time: 85ms
memory: 245256kb

input:

1000
xggpgggpggggpgpxpxxxxppgxxxgxppxpppgpxgpgxgggggpxpggxxpxxggggxpxgppgxxgpppgpgggpgpxpgggxggggxxppgxpxpgpxgpgxgxxggxxxgpxpppgxgpgpxpgppggxxxpgxpxgxggpgpgpxppgpggppgxxxxgpxpppppgxpgpppxxppppppgxxxpxpxpgxpxxxgpgpppgppxpggxpxgxgpxgggppxxgppxggpxggxpppxgpggxgxxpxgppggxgxggggppxxppggpxppppgxgpgxggxgxp...

output:

285794167

result:

ok single line: '285794167'

Test #61:

score: 0
Accepted
time: 77ms
memory: 238940kb

input:

1000
eoeosieseeoxsisexxixxxeeoiesxlxsosilelsisoiieeoolxiooiolslxeixiosolilxxioiilelxeeixoxxiosxoesioeslelxeeoeliliisoiilosllolxlxoooeessxsxeoleiixsieoxiellsiesoileelxioesloeoisilssosxlsxoessisxiesesieoeiolsolooeolioxxeixlssseislseeeiieloxielxsoxxxlexieixollslessloxisissisioxxxliisososesxoxxsollxsxee...

output:

1503495632

result:

ok single line: '1503495632'

Test #62:

score: 0
Accepted
time: 56ms
memory: 235904kb

input:

1000
maqqqkydmsgeqdgmqtkmgdrqmcmrkgqdcmgyvedvtqymkgdkyakveevkqgkmgktrgevryqkkceydvteskymdmqqysyrqtgaccceyrkgvcrgckvggmmvcqmmvvqscsavcagyegqvdqcqeqqcaggmaqydvydacqrgmeryvvmsqgcsqmsrdykcsqvgmactvktqcqqgtydktdecmvkrdqyrgykvmddyytmkrcmvacgvdeeqdtqyqedydmvytccegqtvmskdkqydkgsyqqtgkcgtmstvqtryagsyaqeceagy...

output:

9030992

result:

ok single line: '9030992'

Test #63:

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

input:

1000
hdjrirtrqigvdkoansmktqssuomazunotwbcspcpluflnkgswdlmwrtzfcsjodjwwvzljizoioddsrugqulzemcgeovldweqwqeimyyrtzxffonviyacfddeixwudqugtzlipdrhzevqoqfzrfhjpixdqwqulvzbqccoxrjohwkiaclepmlyxyynxjaxibxkddxvgjzjvgoskjkvkwqosdytmlpuljzqjxjyylivtwshhcswwerqgzzwmklbjtpxunoyjfgrbwtnzlnarcmgdfgwocokifkbnhwnthp...

output:

8429751928

result:

ok single line: '8429751928'

Test #64:

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

input:

1000
scyeaffmdnqueqctqhsdahwfxmhohmysmennkasvotanwurdavpdgitjohukxjiowlqfrouyrztmpkvtxzpgoekdigjytijvifhzveytztqhlspnzggdadynvmfxrnyfxqlaxhgmblpiwzcqrhtsejunhrgsejcskbtusxuuqecnhtnmuevqipnmmaoznalrdswxixoryablxfujuwyoldkmpeweiyiegdjormxghevjtffllzscyeaffmdnqueqctqhsdahwfxmhohmysmennkasvotanwurdavpdg...

output:

1285

result:

ok single line: '1285'

Test #65:

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

input:

1000
nqvnqvnqvnqvnqvnqvnqvnqvnqvnqvnqvnqvnqvnqvnqvnqvnqvnqvnqvnqvnqvnqvnqvnqvnqvnqvnqvnqvnqvnqvnqvnqvnqvnqvnqvnqvnqvnqvnqvnqvnqvnqvnqvnqvnqvnqvnqvnqvnqvnqvnqvnqvnqvnqvnqvnqvnqvnqvnqvnqvnqvnqvnqvnqvnqvnqvnqvnqvnqvnqvnqvnqvnqvnqvnqvnqvnqvnqvnqvnqvnqvnqvnqvnqvnqvnqvnqvnqvnqvnqvnqvnqvnqvnqvnqvnqvnqvnqvn...

output:

315868

result:

ok single line: '315868'

Test #66:

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

input:

1000
dpbybypnitkcxfdzqqqsxyydrswznsbscjfrgpcqbfzcvgyggaxitssgepcukycchbnpmfnkosikhvtfqyqpozvssysgmawiiaokzcifqgdppudofnzhakboxtzjawaikjoapytyabxefdfraohcbsmlhubsectkatagjknfeqowmglrlzpsyzgzsbocyekvnssnjvubgqhnvswqthfladiogbudpbybypnitkcxfdzqqqsxyydrswznsbscjfrgpcqbfzcvgyggaxitssgepcukycchbnpmfnkosik...

output:

448000

result:

ok single line: '448000'

Test #67:

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

input:

1000
eomkrhnwnwqqczdmvzlztumwydgnnvyjelqsskgkkhemzpsgagdwgxvcnuvdcdxpwngjqizenvvjfavcxpbdjuyybtqqofhhkqqeomkrhnwnwqqczdmvzlztumwydgnnvyjelqsskgkkhemzpsgagdwgxvcnuvdcdxpwngjqizenvvjfavcxpbdjuyybtqqofhhkqxeomkrhnwnwqqczdmvzlztumwydgnnvyjelqsskgkkhemzpsgagdwgxvcnuvdcdxpwngjqizenvvjfavcxpbdjuyybtqqofhhk...

output:

10000

result:

ok single line: '10000'

Test #68:

score: 0
Accepted
time: 131ms
memory: 213404kb

input:

1000
riwcdcheriwcdriwcdcheriwcdcheriwcdriwcdcheriwcdriwcdcheriwcdcheriwcdriwcdcheriwcdcheriwcdriwcdcheriwcdriwcdcheriwcdcheriwcdriwcdcheriwcdriwcdcheriwcdcheriwcdriwcdcheriwcdcheriwcdriwcdcheriwcdriwcdcheriwcdcheriwcdriwcdcheriwcdcheriwcdriwcdcheriwcdriwcdcheriwcdcheriwcdriwcdcheriwcdriwcdcheriwcdch...

output:

10693219618

result:

ok single line: '10693219618'

Test #69:

score: 0
Accepted
time: 127ms
memory: 212988kb

input:

1000
bvtgqxpobvtgqbvtgqxpobvtgqxpobvtgqbvtgqxpobvtgqbvtgqxpobvtgqxpobvtgqbvtgqxpobvtgqxpobvtgqbvtgqxpobvtgqbvtgqxpobvtgqxpobvtgqbvtgqxpobvtgqbvtgqxpobvtgqxpobvtgqbvtgqxpobvtgqxpobvtgqbvtgqxpobvtgqbvtgqxpobvtgqxpobvtgqbvtgqxpobvtgqxpobvtgqbvtgqxpobvtgqbvtgqxpobvtgqxpobvtgqbvtgqxpobvtgqbvtgqxpobvtgqxp...

output:

35162000

result:

ok single line: '35162000'

Test #70:

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

input:

1000
nnehwlmxwqxprnmbwnhuivaijrgunrvpivpevdkeiwrggbkpcplcpawygjkwezitsdvmndkdivzitbtgkxvywvvvajcwtpbihrenineiecvrxchnsomljzwhmxcnamhaquexogehpntlkaikokwcjadltskvqdotxxxrakhjxxiqqcnlhlycinwytzdrjhurewcbisrankzkmmlhluswoorgqhfitgzaeahhemrtqlrvwzhkvklfheufdbjfjmspuqzkuesrjcuarllzluopvxsjcrjkuesmfzotevv...

output:

996000000000

result:

ok single line: '996000000000'

Subtask #6:

score: 38
Accepted

Dependency #1:

100%
Accepted

Dependency #2:

100%
Accepted

Dependency #3:

100%
Accepted

Dependency #4:

100%
Accepted

Dependency #5:

100%
Accepted

Test #71:

score: 38
Accepted
time: 189ms
memory: 478060kb

input:

1581
vvlllvvvlvllvvvllvlvvlllllvllllvllvvvvlvvvvvvlvllvvvvlvvvllvvvvvlvvvlvvvllvvvllvlvvlvlvlllvvvvvvllvlllllvvvvvlllvvvvlvlvlvlllvvlllvlvvlvvllvvvvvlvvvlvvlvllllvvlvvlvvlvlllvlvvvvvlllvlvlllvvlllvlvvllllvlvllllvvvvvllvvvlvlvlvvvlvvlvvlvlvllvllvlvvlvlllvvlvvlvlvllvlvlvvvlllvlllvlvlllvvvvvvvvllvllllv...

output:

357492149710

result:

ok single line: '357492149710'

Test #72:

score: 0
Accepted
time: 358ms
memory: 272696kb

input:

2500
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa...

output:

80066492

result:

ok single line: '80066492'

Test #73:

score: 0
Accepted
time: 469ms
memory: 1035848kb

input:

2500
gfgffgffffggfgfgfgfggfggfffgffgffggfgfgggffggfgffggggffffgfffgffgggfgfggfggffggfffggfffffgffgggfgffgfggggfgfgfgffgffffffgggggfggffgffgggffgfgggfffgffgggfffgggffgggfgfgffgfgfffggffggggggfggffgfgfgggfgfggfffgggfgffgffggggfffgfggggfggfgfgfgfgggffggggffggggfgfffffffggffffggffgfggffggggfggffffgggfff...

output:

56755896864

result:

ok single line: '56755896864'

Test #74:

score: 0
Accepted
time: 465ms
memory: 997644kb

input:

2500
ggooggoggooqqooqqooggogooggoogggoqggoggoogqqoqoogqoqqoqqqggggoooqgqgqgooogoooqqogqoggggqoqoggggogqooggqoqgooogqqogggqgggoggqggggogggoqgqqggoqqqqqoqgggqqqqqoqooqoqqqoooggqogggoqoqoqqqqoqogqqqqgggogqgooogooqgogqogqoqqqogqqgggqooggqqqqqqooggggqqoqqgoqgqggqggqoqgogqogoggooqoooqoqggggoqqqgqoooggqqoq...

output:

493393733358

result:

ok single line: '493393733358'

Test #75:

score: 0
Accepted
time: 373ms
memory: 967660kb

input:

2500
uuuunnnnnwxnncxcnnnguugguxnnucccwnugwgnxuxwuwunguwxnxwwunxxnnnnngwncxwuuucwnwnuuwucnunnxwgxxgwxccxwxncunucgngggwuccgwnwxxgncngcxggwcuxwxgwgucwxnwgnugwgnxxxucugwxuguuwucwguuxxgnwgxucxwuugnuxucgngunuxucccucgccnxncgngnggucxxcugncuxnwgngnuwwuwccnxgxuguxwwgggxcxgwcnwunwccgwcunwwuxxwngugunwuxnccunxwx...

output:

12500

result:

ok single line: '12500'

Test #76:

score: 0
Accepted
time: 392ms
memory: 948764kb

input:

2500
hjjjwhghjngghyzjsjrejhyxeuhgzgrnsnezhwegzjzxstgerjuwyexgwyznrjtesgzwsshhzxytjruenerhwynsnyhjrnxynxjeyxshxzshzwjntrznyewjjeungtzhugjujsxynxtszwwwegxgnhryssnjgwtjsggryxxtrtxuuzjstzewrtngwhyztntzrzyjsjjuzzehjrggnhsyjwryjjetgtwhzxttruettzrsextrgwrhuswrrurxjynswhnuherxhsretyyyhhjtwhssegsgryytezhnxzy...

output:

11605284521

result:

ok single line: '11605284521'

Test #77:

score: 0
Accepted
time: 357ms
memory: 940428kb

input:

2500
komnncziwphrtppuccqegeqcmokzngtzmozgegdnthfoofwocglwjyhcubjypbdqjujgnwgxhrbqqbruyclollfzuwgxslysqromwvrayjtovrnjqivwtgvdaboqrqpgvrurgfkhwcbafopzbmnooagdyfkihbgwpoqxidkmdtqrvirmhsbjbfqxrmtfktcdckedlwbymleclvyfaeoqtpazjnkvkysmaxxfkqmhfnhvueeukrmoqvkrndvbqofdwhikngoodcwyxbqdzagvteqxudarazmgqtfxcan...

output:

11047125000

result:

ok single line: '11047125000'

Test #78:

score: 0
Accepted
time: 540ms
memory: 316040kb

input:

2500
ylhdnlgvhnwgcmhgsktbbjvtzsbvagazldaspjnlxrhhjlzkdkyjfalzucplztvylhdnlgvhnwgcmhgsktbbjvtzsbvagazldaspjnlxrhhjlzkdkyjfalzucplztvylhdnlgvhnwgcmhgsktbbjvtzsbvagazldaspjnlxrhhjlzkdkyjfalzucplztvylhdnlgvhnwgcmhgsktbbjvtzsbvagazldaspjnlxrhhjlzkdkyjfalzucplztvylhdnlgvhnwgcmhgsktbbjvtzsbvagazldaspjnlxrh...

output:

1309962026

result:

ok single line: '1309962026'

Test #79:

score: 0
Accepted
time: 441ms
memory: 284900kb

input:

2500
njayaccgyeptonjayaccgyeptonjayaccgyeptonjayaccgyeptonjayaccgyeptonjayaccgyeptonjayaccgyeptonjayaccgyeptonjayaccgyeptonjayaccgyeptonjayaccgyeptonjayaccgyeptonjayaccgyeptonjayaccgyeptonjayaccgyeptonjayaccgyeptonjayaccgyeptonjayaccgyeptonjayaccgyeptonjayaccgyeptonjayaccgyeptonjayaccgyeptonjayaccgy...

output:

522500

result:

ok single line: '522500'

Test #80:

score: 0
Accepted
time: 369ms
memory: 737528kb

input:

2500
qocxjmvtjsdkbjgvhjseelgpytdwhuuazoixjwtjlnwcpxkbhmhmezsejtnbnxfxtrnjkebnlrxuddqhxyossefoglnrgwkkbknpkwmrimnvdmylfebcyzxpuulyhmzchztduulbpglmujzzamotmindgwymauymwbsbsbiprpptdokcnmvsuztuzmhhjewkalvagaurcxkaqbzaongqxkwosrvszhugshdkfxcekjeprtjpyqoucsfnxhyyblzowibavareizufwbivvbznpaugcqwpvjihfaxhboz...

output:

19638978

result:

ok single line: '19638978'

Test #81:

score: 0
Accepted
time: 408ms
memory: 799172kb

input:

2500
axhkdpuswabgrzwbsysbkrvnvnckxhdjynszikqfqlofmwweenxrpocrjkbubxdnbswyhrgkngypyrypyejqfzfrfxvirkaujcvjskieqwbhqocmjnxczrqurgawcyllvohqudtnqhbvwzzhhyqrmvfbtpvengsbzlptjkteiwbbityjwuaxryccuufrdbatugbrxxrqqgunkxudvwlubirurlreiserjaxhkdpuswabgrzwbsysbkrvnvnckxhdjynszikqfqlofmwweenxrpocrjkbubxdnbswyhr...

output:

2209414

result:

ok single line: '2209414'

Test #82:

score: 0
Accepted
time: 909ms
memory: 770600kb

input:

2500
vrqknjjjvrqknvrqknjjjvrqknjjjvrqknvrqknjjjvrqknvrqknjjjvrqknjjjvrqknvrqknjjjvrqknjjjvrqknvrqknjjjvrqknvrqknjjjvrqknjjjvrqknvrqknjjjvrqknvrqknjjjvrqknjjjvrqknvrqknjjjvrqknjjjvrqknvrqknjjjvrqknvrqknjjjvrqknjjjvrqknvrqknjjjvrqknjjjvrqknvrqknjjjvrqknvrqknjjjvrqknjjjvrqknvrqknjjjvrqknvrqknjjjvrqknjj...

output:

253029917475

result:

ok single line: '253029917475'

Test #83:

score: 0
Accepted
time: 924ms
memory: 770352kb

input:

2500
sojcohglsojcosojcohglsojcohglsojcosojcohglsojcosojcohglsojcohglsojcosojcohglsojcohglsojcosojcohglsojcosojcohglsojcohglsojcosojcohglsojcosojcohglsojcohglsojcosojcohglsojcohglsojcosojcohglsojcosojcohglsojcohglsojcosojcohglsojcohglsojcosojcohglsojcosojcohglsojcohglsojcosojcohglsojcosojcohglsojcohg...

output:

10100000

result:

ok single line: '10100000'

Test #84:

score: 0
Accepted
time: 375ms
memory: 940032kb

input:

2500
scujppdysurijazlnavalkwbmwlgxoulpqjhqxsjiajkgfxmyyqbtnxuvesztyifervhsdinjyuzbilrntchawwfvejeevhwcgcvfesbnvniynmmvxwbdugbitvmpkwvbbtfrlliqyinvccobafwajecduxfcelscdqckunzuepakhyqzqxiihshsrdcdsxfylvuaurvhfkjjwtjeubldgvxzeesexdxprdrljdrkejblotyhhgzqmewaenxobicciarzxnqwqmdnqqofdxeoswfgerywcmyjexgrxr...

output:

2493000000000

result:

ok single line: '2493000000000'

Extra Test:

score: 0
Extra Test Passed