QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#864753#8073. StringMini_PEKKATL 550ms121372kbC++142.5kb2025-01-20 23:28:522025-01-20 23:28:54

Judging History

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

  • [2025-01-20 23:28:54]
  • 评测
  • 测评结果:TL
  • 用时:550ms
  • 内存:121372kb
  • [2025-01-20 23:28:52]
  • 提交

answer

#include <bits/stdc++.h>
#include <bits/extc++.h>
#define sz(a) (ll)a.size()
#define pb push_back
#define rep(i,x,y) for(ll i=(x);i<=(y);i++)
using namespace std;
using namespace __gnu_pbds;
using ll=long long;
using ull=unsigned long long;
using db=double;
const ll N=200005;
const db alpha=0.4;
const ull B=19260817;
ll n,q,sz[N],z1[N],z2[N],lcp1[N],lcp2[N],ans[N];
char a[2][N],b[N];
string c[N];
vector<ll> id[N];
ull h[2][N],pB[N],hc[N];
ull calh(ll l,ll r,ll op){
	return h[op][r]-h[op][l-1]*pB[r-l+1];
}
int main(){
	ios::sync_with_stdio(0),cin.tie(0);
	rep(i,0,1){
		string s;
		cin>>s;
		n=s.length();
		rep(j,1,n){
			a[i][j]=s[j-1];
			h[i][j]=h[i][j-1]*B+a[i][j];
		}
	}
	pB[0]=1;
	rep(i,1,n){
		pB[i]=pB[i-1]*B;
	}
	cin>>q;
	rep(i,1,q){
		cin>>c[i];
		sz[i]=c[i].length();
		id[sz[i]].pb(i);
		for(char j:c[i]){
			hc[i]=hc[i]*B+j;
		}
	}
	rep(i,2,n){
		if(sz(id[i])>alpha*i){
			gp_hash_table<ull,ll> cnth;
			rep(j,1,n-i+1){
				rep(k,j,j+i-2){
					cnth[calh(j,k,0)*pB[i-(k-j+1)]+calh(k+1,j+i-1,1)]++;
				}
			}
			for(ll j:id[i]){
				ans[j]=cnth[hc[j]];
			}
		}
	}
	rep(i,1,q){
		if(sz[i]==1||sz[i]>n){
			cout<<0<<'\n';
		}
		else if(sz(id[sz[i]])>alpha*sz[i]){
			cout<<ans[i]<<'\n';
		}
		else{
			rep(j,1,sz[i]){
				b[j]=c[i][j-1];
			}
			for(ll j=2,l=1,r=0;j<=sz[i];j++){
				z1[j]=0;
				if(j<=r){
					z1[j]=min(r-j+1,z1[j-l+1]);
				}
				while(j+z1[j]<=sz[i]&&b[j+z1[j]]==b[z1[j]+1]){
					z1[j]++;
				}
				if(j+z1[j]-1>r){
					l=j;
					r=j+z1[j]-1;
				}
			}
			for(ll j=sz[i]-1,l=sz[i]+1,r=sz[i];j>=1;j--){
				z2[j]=0;
				if(j>=l){
					z2[j]=min(j-l+1,z2[sz[i]-(r-j+1)+1]);
				}
				while(j-z2[j]>=1&&b[j-z2[j]]==b[sz[i]-z2[j]]){
					z2[j]++;
				}
				if(j-z2[j]+1<l){
					l=j-z2[j]+1;
					r=j;
				}
			}
			for(ll j=1,l=1,r=0;j<=n;j++){
				lcp1[j]=0;
				if(j<=r){
					lcp1[j]=min(r-j+1,z1[j-l+1]);
				}
				while(j+lcp1[j]<=n&&lcp1[j]+1<=sz[i]&&a[0][j+lcp1[j]]==b[lcp1[j]+1]){
					lcp1[j]++;
				}
				if(j+lcp1[j]-1>r){
					l=j;
					r=j+lcp1[j]-1;
				}
			}
			for(ll j=n,l=n+1,r=n;j>=1;j--){
				lcp2[j]=0;
				if(j>=l){
					lcp2[j]=min(j-l+1,z2[sz[i]-(r-j+1)+1]);
				}
				while(j-lcp2[j]>=1&&sz[i]-lcp2[j]>=1&&a[1][j-lcp2[j]]==b[sz[i]-lcp2[j]]){
					lcp2[j]++;
				}
				if(j-lcp2[j]+1<l){
					l=j-lcp2[j]+1;
					r=j;
				}
			}
			ll ans=0;
			rep(j,1,n-sz[i]+1){
				ll k=j+sz[i]-1;
				ans+=max(0ll,j+lcp1[j]-1-(k-lcp2[k]+1)+(lcp1[j]<sz[i])+(lcp2[k]<sz[i]));
			}
			cout<<ans<<'\n';
		}
	}
	return 0;
}

详细

Test #1:

score: 100
Accepted
time: 0ms
memory: 20200kb

input:

aaababaa
aababbca
7
aa
abb
aab
ab
abc
bb
ba

output:

3
1
3
2
2
1
0

result:

ok 7 lines

Test #2:

score: 0
Accepted
time: 2ms
memory: 24308kb

input:

baabaabbaaaaabaabbababababaabbaababaaababbbabbabaa
aabaabaabbbbbabaababbbbaaabbbaabaabaabbbabbabbbbab
10
bb
abaaa
aabb
aab
bb
ba
bba
bab
baa
abba

output:

11
4
10
11
11
11
8
19
8
10

result:

ok 10 lines

Test #3:

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

input:

aababbababaaaaaabbababaaabbabbbbbbaaabbbbaaabaabaaabaaaabbbabababaaabbababbbaaaabbbbbaabaaababbaaaaaaabaabaabaabbbbbbaabbbabababbabbbbabbabababaaaabaaaaabbbbaababbbbaaabbbbbaabaabbaababbaaabaabaaabbbbaabababaaabbbbabaababababbbaababbabbbbbbabbbbaaabbaaabbbabbabaabbaaabaaaabbbbbbbaabaabbbbbbabbbbabbb...

output:

7767
7715
909
1491
2808
4622
4678
911
1652
4693
854
7763
1579
7833
903
845
7878
4658
891
4721
2709
7835
896
4643
2748
7870
7795
1574
4577
4777
7767
4683
7652
7833
844
7715
7713
4577
2791
839
4657
4693
2781
890
2706
4839
2804
7745
4717
4629
871
4704
4694
845
938
4709
921
2629
1573
2577
1552
1570
2735...

result:

ok 10000 lines

Test #4:

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

input:

abbbbbbbbabbbbbbabbbbbbbbbbbbbbabbbbbbbabbbbbbbbababbbbbbbbabbbbbbbbbabbbbbbbbbbbbbbbbbbbbbabbbbbbbbbbbaababbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbaabbbbbbbbbbbbabbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbabbaababbbbbbbbbbabbabbbbabbbbbbbbbbbbbbbbbbbbbbbbaabbbbbbbbbbbbbabbbbbbbbbbbbbbbbbbbbabbbbbbbbabbbbbabbbab...

output:

34850
31846
329
401
3814
34948
33612
3183
361
266595
29417
302399
302399
32019
266595
302399
302399
31846
35131
417
29417
29518
266595
34288
29518
287986
287986
34389
315008
3547
3538
302399
33730
266595
287986
29417
33467
311153
3901
287986
32019
35094
266595
315008
311153
3674
266595
33467
266595
...

result:

ok 10000 lines

Test #5:

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

input:

bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbabbbbbbbbbbbbbbbbbbbbabbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbabbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbabbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb...

output:

557438
643590
643590
810239
469439
557438
810239
727850
643590
557438
7951
810239
469439
727850
469439
727850
469439
643590
643590
810239
643590
8501
469439
6737
557438
810239
810239
810239
557438
469439
557438
469439
810239
727850
810239
8910
643590
810239
643590
810239
810239
643590
643590
727850
...

result:

ok 10000 lines

Test #6:

score: 0
Accepted
time: 10ms
memory: 27340kb

input:

bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb...

output:

30332
0
313061608
29671
0
0
0
314370702
319012593
33652

result:

ok 10 lines

Test #7:

score: 0
Accepted
time: 82ms
memory: 29448kb

input:

bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb...

output:

34853112
36299
40248
33664728
38863
0
0
38064
796
34862762
34709168
0
34621745
34495725
34294358
0
34841561
0
36683
40286
33960688
40111
34701284
33140841
33770
0
40154
0
34180679
34654709
40663
40135
34536818
38227
34228418
34365767
0
0
35763
37936
34565447
34835037
34479707
38864
33664728
37636
34...

result:

ok 100 lines

Test #8:

score: 0
Accepted
time: 263ms
memory: 119224kb

input:

uerusvmzbugopnwcvdqnubfjhztzqskhsvxdphbiwltiyttphztkrhxqdfuqrlxdehenhtvogyqeilhgexsoafhsjcctjkjbpqsyosjefzcepgpatrfbmpoqgkngqfejugupbkeisszlckpaqhdbxipzmngcoynandwjnqlultpesmpzvtcnaqeeclazmoblypsmwzwrcwizumbnyrdsibhydeplvrmkyghizudojhqswvajsskrxwofxsnvfwyjqipxtwtbzsumijxyvptuqsekwpkuvmqzpkchaxissqlz...

output:

0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
2
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
...

result:

ok 10000 lines

Test #9:

score: 0
Accepted
time: 245ms
memory: 121368kb

input:

ggfhhdbgjfagabaabjjcibcbcifgjcigjjjgdajfeegejdffgihgchdjjbhchdbcjhecjggfjcfdahbcbjejeggiddjfjcegifbifjggeciiifhfeehjcgebfgefdhejgfijddedgccebbibadjedagebedbbgibjdefjfgfhagjabeiiajbhgdggfihhfbdihdgeciaejhbdegbcjjbfgdiigecdbifdjhbcijddbijeibbbacgbdbfejajhdaajfejidibbciehjaabjbdiihfggdedjfbbdeifbijahih...

output:

0
0
3
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
3
0
0
0
0
0
0
0
6
0
0
0
0
3
1
0
0
1
0
0
0
2
2
0
2
0
0
0
2
0
1
0
0
3
0
0
0
0
0
0
0
6
0
0
0
0
0
0
0
2
0
0
0
2
1
1
0
4
1
0
0
0
0
0
0
0
0
0
0
0
3
0
2
0
0
0
1
0
0
0
0
0
0
0
1
0
0
0
0
0
1
0
0
0
0
1
0
0
0
0
0
0
0
0
7
0
0
0
5
0
0
0
3
0
0
3
0
1
0
4
1
5
0
0
7
0
0
0
0
0
0
...

result:

ok 10000 lines

Test #10:

score: 0
Accepted
time: 156ms
memory: 121372kb

input:

baedbcceddedebadcecccbbbcaeecacaecbdcacdeebeedacbabaecdcbeacbaceebbbadbedbaaeebeadbeebaeaaaabbcdecabdbabadcbcbadcbecabcdedecaaedeadcadebadbedacceabcecabcaaceceedaaedddeababcbcceedcaedcbcadebdcabebadbeadcbbadaeedebeabbbbceccceabedcabebbaebccdcceacccbeddabacdcdddbabedaadbadeccaaccddbecbbacdcaedaaeacae...

output:

29
127
0
0
1
1
8
0
23
142
0
3
0
0
0
0
1
4
29
0
122
0
12
25
1
6
7
37
6
26
0
114
0
0
140
4
2
127
1
0
0
36
0
2
8
0
3
129
26
46
3
0
10
145
34
150
0
3
0
25
13
10
0
132
32
119
1
3
0
7
6
5
40
5
36
140
1
28
0
1
0
0
0
136
123
122
109
120
3
124
116
8
130
8
133
124
4
6
146
0
38
0
0
1
0
0
28
0
1
36
2
123
2
1
1
...

result:

ok 10000 lines

Test #11:

score: 0
Accepted
time: 54ms
memory: 29008kb

input:

ccbccbbacabcaaccbcbcabaccaacaccabaaccbacbcaabaaaababcbcacbcccbaccbcaabaabbcacbaaaababbcabcbcabbcabbbccbbbcbbccccababbaacacabbcbcabaaaacbaaacbabcbabaabcbcaaccaaaabbcacacbbbcabcacbcaaabababbbbbbcabcbbabcacbababbaaabcbababbaccbaacbaaccbccacacabcbabaaacbbcabcbaccbcabbaabbbaabcabcbacaccbcbabcbbaaaabbbbab...

output:

1533
15
16
115
88
28
101
302
742
16
1601
1648
1661
8
8
39
40
106
22
717
1636
677
694
1680
1585
36
1653
118
24
661
54
13
681
1677
92
38
96
16
88
672
1616
685
1692
240
35
668
92
21
127
1574
11
33
258
290
22
95
74
129
90
99
707
1597
1677
18
41
278
17
1630
43
33
34
116
20
671
106
1596
258
89
101
18
42
1...

result:

ok 10000 lines

Test #12:

score: 0
Accepted
time: 366ms
memory: 23900kb

input:

myvxrwesifoclqoarxdpmyvxrwesifoclqoarxdpmyvxrwesifoclqoarxdpmyvxrwesifoclqoarxdpmyvxrwesifoclqoarxdpmyvxrwesifoclqoarxdpmyvxrwesifoclqoarxdpmyvxrwesifoclqoarxdpmyvxrwesifoclqoarxdpmyvxrwesifoclqoarxdpmyvxrwesifoclqoarxdpmyvxrwesifoclqoarxdpmyvxrwesifoclqoarxdpmyvxrwesifoclqoarxdpmyvxrwesifoclqoarxdp...

output:

103
45
150
10
208
48
211
20
50
70
60
200
150
50
120
50
40
198
10
144
20
67
0
50
120
80
221
30
137
160
120
20
90
12
159
60
30
162
40
125
130
204
160
94
40
209
30
20
50
110
37
115
105
212
95
59
210
110
190
205
12
117
190
30
150
36
50
12
60
140
72
153
221
36
153
178
185
140
51
200
86
134
96
10
168
100
...

result:

ok 7891 lines

Test #13:

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

input:

kvafreigfamumerkwusivmybtnkvajlylqimmzrglwcergnonbkvafreigfamumerkwusivmybtnkvajlylqimmzrglwcergnonbkvafreigfamumerkwusivmybtnkvajlylqimmzrglwcergnonbkvafreigfamumerkwusivmybtnkvajlylqimmzrglwcergnonbkvafreigfamumerkwusivmybtnkvajlylqimmzrglwcergnonbkvafreigfamumerkwusivmybtnkvajlylqimmzrglwcergnonb...

output:

130
260
207
63
80
2000
230
20
288
50
198
40
190
279
261
150
126
20
351
60
260
234
60
2000
261
279
207
40
351
9
27
160
380
27
306
234
40
198
30
40
261
0
90
180
45
70
144
210
270
50
150
54
360
220
333
40
99
130
30
90
153
162
310
207
72
230
90
90
150
72
380
190
81
81
250
36
144
135
27
180
320
90
333
15...

result:

ok 7865 lines

Test #14:

score: 0
Accepted
time: 378ms
memory: 21228kb

input:

tkfbktlkeiklcblwmlwwktqmtlpwvjjsmxjdkitaswwmyffzadnavriqeteqbeeixhhfeqomcbhsorfeqzxtowkaorfymtbwcmnttkfbktlkeiklcblwmlwwktqmtlpwvjjsmxjdkitaswwmyffzadnavriqeteqbeeixhhfeqomcbhsorfeqzxtowkaorfymtbwcmnttkfbktlkeiklcblwmlwwktqmtlpwvjjsmxjdkitaswwmyffzadnavriqeteqbeeixhhfeqomcbhsorfeqzxtowkaorfymtbwcmnt...

output:

387
160
252
261
0
18
234
315
306
423
441
48
32
324
0
396
171
45
225
369
252
297
171
232
207
184
189
342
297
1270
18
32
117
324
360
27
162
136
414
176
288
216
272
279
104
144
117
99
104
216
1297
306
32
234
336
224
64
261
0
360
351
261
81
432
1189
45
99
225
324
1315
405
315
90
312
288
18
0
117
216
288...

result:

ok 7908 lines

Test #15:

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

input:

bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb...

output:

599964
499975
699951
499975
499975
499975
899919
899919
499975
399984
799936
899919
599964
799936
699951
699951
699951
899919
799936
499975
399984
599964
499975
599964
899919
399984
699951
399984
899919
699951
599964
699951
499975
699951
799936
499975
599964
399984
499975
499975
899919
699951
799936...

result:

ok 20000 lines

Test #16:

score: 0
Accepted
time: 345ms
memory: 22192kb

input:

puyrrzvldepuyrrzvldepuyrrzvldepuyrrzvldepuyrrzvldepuyrrzvldepuyrrzvldepuyrrzvldepuyrrzvldepuyrrzvldepuyrrzvldepuyrrzvldepuyrrzvldepuyrrzvldepuyrrzvldepuyrrzvldepuyrrzvldepuyrrzvldepuyrrzvldepuyrrzvldepuyrrzvldepuyrrzvldepuyrrzvldepuyrrzvldepuyrrzvldepuyrrzvldepuyrrzvldepuyrrzvldepuyrrzvldepuyrrzvlde...

output:

55
10
20
42
40
77
21
21
10
67
77
26
121
88
39
22
50
60
88
50
108
10
22
22
0
24
90
100
80
77
22
44
13
26
40
126
29
50
10
10
13
77
25
105
30
117
0
0
109
33
80
111
96
67
100
101
50
55
66
10
39
125
99
55
99
52
40
124
66
99
55
110
30
80
52
57
18
32
126
60
65
33
112
0
50
110
110
100
11
65
33
66
99
20
109
...

result:

ok 7905 lines

Test #17:

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

input:

fnlekfnlekfnlekfnlekfnlekfnlekfnlekfnlekfnlekfnlekfnlekfnlekfnlekfnlekfnlekfnlekfnlekfnlekfnlekfnlekfnlekfnlekfnlekfnlekfnlekfnlekfnlekfnlekfnlekfnlekfnlekfnlekfnlekfnlekfnlekfnlekfnlekfnlekfnlekfnlekfnlekfnlekfnlekfnlekfnlekfnlekfnlekfnlekfnlekfnlekfnlekfnlekfnlekfnlekfnlekfnlekfnlekfnlekfnlekfnlek...

output:

11
19892
12
10
10
50
40
68
19926
48
40
11
22
66
11
12
19902
20
19926
48
22
11
55
11
20000
40
48
22
22
22
50
19985
19973
0
11
19937
67
55
24
19915
10
19926
44
10
22
44
10
11
26
12
11
0
50
44
30
10
60
22
44
48
19985
22
19959
19959
54
60
0
16
42
55
24
24
42
40
22
55
11
67
44
55
19959
40
55
44
11
44
44
...

result:

ok 7861 lines

Test #18:

score: 0
Accepted
time: 514ms
memory: 23688kb

input:

rzorzorzorzorzorzorzorzorzorzorzorzorzorzorzorzorzorzorzorzorzorzorzorzorzorzorzorzorzorzorzorzorzorzorzorzorzorzorzorzorzorzorzorzorzorzorzorzorzorzorzorzorzorzorzorzorzorzorzorzorzorzorzorzorzorzorzorzorzorzorzorzorzorzorzorzorzorzorzorzorzorzorzorzorzorzorzorzorzorzorzorzorzorzorzorzorzorzorzorzo...

output:

31
15
11
31
37
33230
33278
33208
12
11
12
31
33175
33186
31
13
10
33266
11
34
37
31
15
34
12
34
37
33278
12
33242
11
11
34
13
33242
31
12
31
16
31
33142
42
31
31
33219
34
33304
28
11
31
12
31
31
31
12
33164
12
31
12
33164
12
11
11
33242
31
31
14
31
33175
11
34
33197
12
11
12
11
31
11
34
31
33278
332...

result:

ok 7801 lines

Test #19:

score: 0
Accepted
time: 550ms
memory: 21976kb

input:

oxeoxeoxeoxeoxeoxeoxeoxeoxeoxeoxeoxeoxeoxeoxeoxeoxeoxeoxeoxeoxeoxeoxeoxeoxeoxeoxeoxeoxeoxeoxeoxeoxeoxeoxeoxeoxeoxeoxeoxeoxeoxeoxeoxeoxeoxeoxeoxeoxeoxeoxeoxeoxeoxeoxeoxeoxeoxeoxeoxeoxeoxeoxeoxeoxeoxeoxeoxeoxeoxeoxeoxeoxeoxeoxeoxeoxeoxeoxeoxeoxeoxeoxeoxeoxeoxeoxeoxeoxeoxeoxeoxeoxeoxeoxeoxeoxeoxeoxeoxe...

output:

0
0
33319
0
33318
0
0
33321
0
0
33325
0
0
0
0
0
0
33324
0
0
0
0
0
0
0
0
0
0
33327
0
33331
0
0
0
33327
0
0
33326
0
0
0
0
0
33325
33326
33325
0
0
33326
0
0
0
33331
0
33332
0
0
33326
0
0
0
0
33323
0
0
33330
0
33319
0
33320
33320
0
0
0
0
33320
33317
0
0
33319
0
33331
0
0
0
0
0
0
0
0
0
0
0
33324
0
33329
...

result:

ok 7823 lines

Test #20:

score: 0
Accepted
time: 419ms
memory: 20896kb

input:

yryryryryryryryryryryryryryryryryryryryryryryryryryryryryryryryryryryryryryryryryryryryryryryryryryryryryryryryryryryryryryryryryryryryryryryryryryryryryryryryryryryryryryryryryryryryryryryryryryryryryryryryryryryryryryryryryryryryryryryryryryryryryryryryryryryryryryryryryryryryryryryryryryryryryryr...

output:

0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
...

result:

ok 7889 lines

Test #21:

score: 0
Accepted
time: 475ms
memory: 23744kb

input:

kvkvkvkvkvkvkvkvkvkvkvkvkvkvkvkvkvkvkvkvkvkvkvkvkvkvkvkvkvkvkvkvkvkvkvkvkvkvkvkvkvkvkvkvkvkvkvkvkvkvkvkvkvkvkvkvkvkvkvkvkvkvkvkvkvkvkvkvkvkvkvkvkvkvkvkvkvkvkvkvkvkvkvkvkvkvkvkvkvkvkvkvkvkvkvkvkvkvkvkvkvkvkvkvkvkvkvkvkvkvkvkvkvkvkvkvkvkvkvkvkvkvkvkvkvkvkvkvkvkvkvkvkvkvkvkvkvkvkvkvkvkvkvkvkvkvkvkvkvkv...

output:

36
22
33
56
39
44
41
38
22
36
22
35
22
33
22
35
33
22
20
39
33
32
33
33
33
24
33
36
44
36
33
33
44
24
48
33
33
48
33
26
44
44
33
36
22
39
33
30
29
22
33
33
36
24
48
39
44
33
0
29
36
36
33
39
39
24
36
30
56
32
33
41
52
22
29
48
42
33
42
33
33
38
24
22
36
39
33
36
44
20
24
48
22
44
38
22
56
44
41
42
3...

result:

ok 7825 lines

Test #22:

score: 0
Accepted
time: 286ms
memory: 23288kb

input:

dddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddd...

output:

3698631
599964
4198236
1199856
0
2799216
2199516
2699271
499975
3398844
2699271
4597884
3898479
99999
4098319
4797696
4398064
499975
999900
2599324
0
1099879
3398844
999900
1899639
299991
3798556
3498775
4398064
3298911
499975
599964
2799216
999900
1899639
799936
2299471
2299471
3398844
199996
99990...

result:

ok 7879 lines

Test #23:

score: 0
Accepted
time: 472ms
memory: 26864kb

input:

aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa...

output:

0
99999
199996
299991
399984
499975
599964
699951
799936
899919
999900
1099879
1199856
1299831
1399804
1499775
1599744
1699711
1799676
1899639
1999600
2099559
2199516
2299471
2399424
2499375
2599324
2699271
2799216
2899159
2999100
3099039
3198976
3298911
3398844
3498775
3598704
3698631
3798556
38984...

result:

ok 600 lines

Test #24:

score: 0
Accepted
time: 470ms
memory: 28004kb

input:

aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa...

output:

0
99998
199993
299985
399974
499960
599943
699923
799900
899874
999845
1099813
1199778
1299740
1399699
1499655
1599608
1699558
1799505
1899449
1999390
2099328
2199263
2299195
2399124
2499050
2598973
2698893
2798810
2898724
2998635
3098543
3198448
3298350
3398249
3498145
3598038
3697928
3797815
38976...

result:

ok 600 lines

Test #25:

score: 0
Accepted
time: 14ms
memory: 25724kb

input:

teiclteiclteiclteiclteiclteiclteiclteiclteiclteiclteiclteiclteiclteiclteiclteiclteiclteiclteiclteiclteiclteiclteiclteiclteiclteiclteiclteiclteiclteiclteiclteiclteiclteiclteiclteiclteiclteiclteiclteiclteiclteiclteiclteiclteiclteiclteiclteiclteiclteiclteiclteiclteiclteiclteiclteiclteiclteiclteiclteicl...

output:

0
0
0
0
13
14
0
0
0
14
14
0
0
13
0
14
14
0
19986
0
0
0
19986
0
14
14
0
0
14
13
14
13
19986
14
0
19986
0
19986
0
14
0
0
14
0
13
14
13
0
0
14
0
0
14
13
0
19986
0
14
14
13
19986
14
0
14
0
14
13
14
0
14
14
0
0
19986
0
0
14
14
14
0
14
19986
0
14
14
19986
14
0
13
13
14
14
0
0
0
13
13
14
19986
14
13
14
0
1...

result:

ok 133343 lines

Test #26:

score: -100
Time Limit Exceeded

input:

etzseetzseetzseetzseetzseetzseetzseetzseetzseetzseetzseetzseetzseetzseetzseetzseetzseetzseetzseetzseetzseetzseetzseetzseetzseetzseetzseetzseetzseetzseetzseetzseetzseetzseetzseetzseetzseetzseetzseetzseetzseetzseetzseetzseetzseetzseetzseetzseetzseetzseetzseetzseetzseetzseetzseetzseetzseetzseetzseetzse...

output:


result: