QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#776207#7364. 回文Link_Cut_Y100 ✓1317ms403912kbC++144.4kb2024-11-23 17:54:092024-11-23 17:54:09

Judging History

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

  • [2024-11-23 17:54:09]
  • 评测
  • 测评结果:100
  • 用时:1317ms
  • 内存:403912kb
  • [2024-11-23 17:54:09]
  • 提交

answer

#include <unordered_map>
#include <algorithm>
#include <iostream>
#include <cstring>
#include <cstdio>
#include <vector>
#include <bitset>
#include <cmath>
#include <queue>
#include <ctime>
#include <set>
#include <map>
#define int long long
#define rep(i, a, b) for (int i = (a); i <= (b); i ++ )
#define rop(i, a, b) for (int i = (a); i < (b); i ++ )
#define dep(i, a, b) for (int i = (a); i >= (b); i -- )
#define dop(i, a, b) for (int i = (a); i > (b); i -- )

#define Darr(a, L, R) cerr << #a "[" << L << " ~ " << R << "] = "; rep(x, L, R) cerr << a[x] << " "; cerr << '\n';
#define IOS ios::sync_with_stdio(false), cin.tie(0), cout.tie(0)
#define D(x) (cerr << #x << " = " << x << '\n')
#define vit vector<int>::iterator
#define all(x) x.begin(), x.end()
#define min(a, b) (a < b ? a : b)
#define max(a, b) (a > b ? a : b)
#define chkmin(a, b) (a = min(a, b))
#define chkmax(a, b) (a = max(a, b))
#define sit set<int>::iterator
#define lowbit(x) (x & -x)
#define eb emplace_back
#define lb lower_bound
#define ub upper_bound
#define pb push_back
#define pi acos(-1)
#define gc getchar
#define pc putchar
#define db double
#define y second
#define x first

using namespace std;

typedef long long LL;
typedef unsigned long long ULL;
typedef pair<int, int> PII;
typedef pair<db, db> PDD;
const int dx[] = {1, 0, -1, 0};
const int dy[] = {0, 1, 0, -1};
const int mod = 998244353;
const int eps = 1e-9;

const int N = 2000010; int T = 1;
void print(int x) { dep(i, 20, 0) pc(((x >> i) & 1) ? '1' : '0'); }
int qpow(int a, int b = mod - 2, int s = 1) { for (; b; b >>= 1, a = 1ll * a * a % mod) if (b & 1) s = 1ll * s * a % mod; return s; }
namespace IO {
	void read() { return; }
	void write(char ch) { pc(ch); return; }
	void write() { return; }
	template <typename T> void read(T &x) { x = 0; T w = 0; char ch = gc(); while (ch < '0' || ch > '9') w |= (ch == '-'), ch = gc(); while ('0' <= ch && ch <= '9') x = x * 10 + (ch ^ 48), ch = gc(); x = w ? -x : x; }
	template <typename T> void print(T x) { if (!x) return; print<T>(x / 10), pc((x % 10) ^ '0'); }
	template <typename T> void write(T x) { if (x > 0) print<T>(x); else if (x < 0) pc('-'), print<T>(-x); else pc('0'); }
	template <typename T> void write(T x, char en) { write<T>(x), pc(en); }
	template <typename T, typename ...T2> void read(T &s, T2 &...oth) { read(s); read(oth...); return; }
}; using namespace IO;

const ULL P = 1331;
ULL p[N], h1[N], h2[N];
char str[N], s[N]; int st1[N][22], st2[N][22];
int n, q, len[N], lg[N];
ULL Hash1(int l, int r) { return 1ull * h1[r] - h1[l - 1] * p[r - l + 1]; }
ULL Hash2(int r, int l) { return 1ull * h2[l] - h2[r + 1] * p[r - l + 1]; }
void sub() {
	scanf("%s", str + 1);
	n = strlen(str + 1); rep(i, 1, n) s[i * 2] = str[i], s[i * 2 - 1] = '#';
	s[n * 2 + 1] = '#'; p[0] = 1ull; n = n * 2 + 1;
	rep(i, 1, n) h1[i] = 1ull * h1[i - 1] * P + 1ull * s[i];
	dep(i, n, 1) h2[i] = 1ull * h2[i + 1] * P + 1ull * s[i];
	rep(i, 1, n) p[i] = p[i - 1] * P;
//	cout << Hash1(1, 3) << ' ' << Hash2(3, 1) << endl; return;
	rep(i, 1, n) {
		int l = 0, r = min(i - 1, n - i);
		while (l < r) {
			int mid = l + r + 1 >> 1;
			if (Hash1(i - mid, i) == Hash2(i + mid, i)) l = mid;
			else r = mid - 1;
		} len[i] = l;
	} rep(i, 1, n) if (i & 1) st1[i][0] = len[i]; else st2[i][0] = len[i];
	rep(j, 1, 20) rep(i, 1, n) st1[i][j] = max(st1[i][j - 1], st1[i + (1 << j - 1)][j - 1]),
		st2[i][j] = max(st2[i][j - 1], st2[i + (1 << j - 1)][j - 1]);
	lg[1] = 0; rep(i, 2, n) lg[i] = lg[i >> 1] + 1;
	auto qmax1 = [&](int l, int r) -> int {
		if (l == r) return len[l]; int d = r - l + 1, o = lg[d];
		return max(st1[l][o], st1[r - (1 << o) + 1][o]);
	};
	auto qmax2 = [&](int l, int r) -> int {
		if (l == r) return len[l]; int d = r - l + 1, o = lg[d];
		return max(st2[l][o], st2[r - (1 << o) + 1][o]);
	};
	auto query = [&](int L, int R) -> int {
		int l = 0, r = (R - L + 1);
		while (l < r) {
//			int mid = 3;
			int mid = l + r + 1 >> 1;
			int _l = 2 * L + mid - 1, _r = 2 * R - mid + 1;
//			D(_l), D(_r), D(mid); exit(0);
//			cout << qmax1(_l, _r) << ' ' << qmax2(_l, _r) << '\n'; exit(0);
			if (_l > _r) r = mid - 1;
			else if (qmax1(_l, _r) >= mid or qmax2(_l, _r) >= mid) l = mid;
			else r = mid - 1;
		} return l;
	};
//	cout << query(1, 3) << '\n'; return;
	read(q); while (q -- ) {
		int L, R; read(L, R);
		printf("%lld\n", query(L, R));
	} return;
}
signed main() {
	while (T -- ) sub();
	return 0;
}

詳細信息


Pretests


Final Tests

Test #1:

score: 5
Accepted
time: 3ms
memory: 16128kb

input:

kmojliclywcyevunhgfnumdzvncnmzbkxjsrkzlyguvjwqmyamvwvidqvfcwnkoolupcrjhynrnlmncqwntqaqtnwqcnmlnrnyhjrcpulooknwcfvqdivwvmaymqwjvugylzkrsmlabbmjltopjasklgawfdbosdlmwahaygutogtvoenkxddmehwokwybkpireouiqqlsfbuqslxjlusnwkzgadxtagewjlchtcezugeguzecthcljwegatxdagzkwnsuljxlsqwlkpvoajknflirxpqcxmyhcgimr
293
...

output:

101
75
83
63
3
2
101
3
3
3
39
3
1
41
3
23
2
1
63
45
1
63
31
1
101
83
3
41
13
63
63
3
2
2
3
1
1
1
1
3
2
63
23
15
15
101
2
31
63
71
101
49
37
2
101
101
3
71
1
63
3
31
85
1
2
63
101
2
3
3
63
3
63
65
63
3
101
63
41
3
3
3
73
7
1
25
63
37
29
17
1
3
3
2
3
101
1
101
1
3
3
63
1
1
31
77
101
89
31
41
101
15
59...

result:

ok 293 lines

Test #2:

score: 5
Accepted
time: 3ms
memory: 16048kb

input:

vesjaxxsumewkbahmdfohuzggavsskdplrjqgonwnvtqhqdvxwdvbbvdwxtostthmmzqckepyglcysblxcbcxlbsyclgylyqtthedcqvuoghiyfekmaycoiiumirusuzosmaijqpgrwgcnxtojzyxpnjzyzjnpxyzjotxncgwrgpqjiamsozusurimuiiocyamkefyihgouvpxqdkybihtpmfqfzlwzylmtpgzvzhcrygruvzztttbofobtttzzvurgyrchzvzgptmlyzwlzfqfmpthibykdqxpegpbglnzk...

output:

81
101
71
49
41
59
101
81
87
101
3
21
101
21
101
101
43
101
59
63
23
19
13
101
25
101
21
75
101
27
3
55
101
27
10
23
87
21
23
39
67
1
3
21
101
21
101
3
3
1
55
10
51
7
101
21
35
2
61
41
15
77
21
10
101
89
101
101
1
4
101
3
101
2
101
101
101
47
3
1
3
101
3
59
3
23
101
1
21
101
101
101
1
19
101
1
3
101...

result:

ok 290 lines

Test #3:

score: 5
Accepted
time: 3ms
memory: 20480kb

input:

anuahqplebjsacgumhxqolpgrxqcqzlhxrdthilfysevwdukoaksysixdggqzfjifopilugpdlrihgriaedgcjljuzdyqnyplpovdlvsitjcizogkcjkipzwnbdugpkkcghcpcioksqbnvfeggpzdfcxddppanaqnjdrtczcurvgdhnhuuxmktusuykwqrpjgauznlzcgxahiumnbeendsvdoflmuqaylnmsxgfdelfljnvlkeftwsvqhrxpnyjfwohdomcrqcxhvfvksfkjaihqiksfwdlopmwyhagelhju...

output:

5
1272
594
117
5
5
1666
5
1666
956
1666
5
1438
1666
1666
4
544
258
928
1666
3
5
3
669
5
1666
3
796
1666
4
1666
5
1666
3
1272
1666
746
1272
1666
862
436
590
289
1666
764
576
4
1506
5
1272
1326
638
5
1666
1272
5
3
1666
1064
606
164
752
1272
5
4
1666
804
1666
5
1272
3
5
1666
3
1666
80
5
4
5
1272
298
16...

result:

ok 4991 lines

Test #4:

score: 5
Accepted
time: 6ms
memory: 18448kb

input:

mfvckuykhckfuqmontrmfcfttxsqnaenocsvdxafpwkpftcwtqwgtsihvaquaudwebxmdijlcrenvivcwbwccmjyxmgmuhdkesgmkcbasghbbwlutayipathsvawcdkkmbdkdiurfsytgjasgsrebgtyjlclkycanipjqlpvxtusmetaxpkwvgilcqnspilinqanxofgxjwqzphraildqdewozyndxbekdknrvbdjgwwvulxfdaqpsziqmrtvlzcabcnouwilynyrbzktbfsfaepmyfjbwuuhvxihiyjicox...

output:

3
1193
698
128
857
3
698
903
5
1665
698
698
93
389
698
625
698
3
3
1665
4
3
1239
435
765
1665
76
537
1665
5
698
5
3
178
625
698
393
698
698
698
3
106
316
1033
651
625
713
1665
698
401
698
1305
1031
5
1097
3
1351
625
119
1393
698
3
625
5
194
698
698
698
321
625
3
421
698
3
698
698
747
1665
885
5
27
6...

result:

ok 4997 lines

Test #5:

score: 5
Accepted
time: 3ms
memory: 20404kb

input:

piliegnejflgljiidtifmgpcwttkfqexweatzcfecoyuyzpyayapbnenfvjbimyuttkjimtuzpoyhfugdivlxyebblrvgkwowzftkjxjopepbcdkcrioyjjscqnvycmaicuijcdkzizgtyskrkgyflmfvtntfnuikjqyblajyhygopbgpmxruwkkkuqszuuxhorfzsyzgpnxcuifrlvieeeavsrrgthetamjemxekupmclxitasqoqrokhtvomrjlksomhagdxyarqqoqhzuiqlhinhizujhkziqnabxnguz...

output:

4
96
1667
3
1667
1
791
791
603
3
3
1407
96
3
4
1667
583
4
319
757
1667
1319
791
563
725
1667
791
901
1667
1221
791
182
1667
1667
1667
1563
5
291
96
179
119
3
1045
4
1249
845
1667
1667
1667
753
96
9
1667
182
291
95
182
791
205
96
182
263
1667
1667
527
291
1445
1667
1667
1667
1
1667
791
281
291
1667
7...

result:

ok 4995 lines

Test #6:

score: 5
Accepted
time: 0ms
memory: 22468kb

input:

syucmgkigdlpevdxsshewqirqqcdljqjgaugkvzplmidhvwxeuhuzmzscczopnaviqlgnavpezpquyupilccvjsqfxjmpcsefwerqlgfitezkaffvdwlyhilzflbjecsikzvyecgpjkucqukkrauolgzffotznjxmbvcmsuzrwstehxgqzygfjfybzmyuoxvshelxlpzfxwalgxzlwvhsbaikzsgjkzvzjmlbhgubzcunksleqdgulmysfjashpwjymspmtoxiwaiimcbdqbbudlwbptrusyumtszzwbpmgg...

output:

495
495
3
7
741
741
1541
1541
495
741
1231
187
7
5
741
5
741
1221
741
551
495
1541
495
741
1541
1051
741
495
1229
741
495
1541
1081
689
1541
277
1259
4
385
4
495
4
495
741
4
805
7
1093
547
741
4
843
741
741
741
7
1403
7
5
451
7
7
495
741
741
371
4
7
399
741
741
281
495
495
3
1541
4
3
4
741
577
4
3
1...

result:

ok 4999 lines

Test #7:

score: 5
Accepted
time: 44ms
memory: 58276kb

input:

acfojkhxkvgskemxswoddjrxylgurlpfkpkhssmaqavonpjkhozprsffoslcluvabbpmynaucitshgbfrhilbxuyvdeilculqepksnsosdruqnzkrismdmpypuwigcwmlrynryysiazxaikbsvsxhwobtxuriupwxfmotimszqrfqqcfcukzmghijkeibpndndbodgzpuzqyznrjpzykhzmgrcxhexbsjmanfybqvojzbwpyttmrneejcpdncuzcjdmgxevqmbltpkotcywnfglumjpldxytuaahbgdcnges...

output:

5769
5769
5769
5769
5769
5769
5769
5769
5769
5769
5769
5769
5769
5769
5769
5769
5769
5769
5769
5769
5769
5769
5769
5769
5769
5769
5769
5769
5769
5769
5769
5769
5769
5769
5769
5769
5769
5769
5769
5769
5769
5769
5769
5769
5769
5769
5769
5769
5769
5769
5769
5769
5769
5769
5769
5769
5769
5769
5769
5769
...

result:

ok 49991 lines

Test #8:

score: 5
Accepted
time: 73ms
memory: 54896kb

input:

aaxvxlcltrlilgqvklenrxdcqzouiizataquwymdxtkzyenpdefayzmwugrysrxpwznxpesvcglwqokoajclkeiadelfupalmwhpceexzuzethlcuidgwekhrzvacntvtfmlqptdszlphlewmmwzwcdmjwpefntdlcdrrhejjhakjpkglpbyooqkdhkzrswpmlseuqobyzrquhtdqlbfegkolncwaqoyxrmelvysykpsschwcghzecwneoklalscjqgxoqilbisabofjebktbbzomfupjqcupolpowbtazlq...

output:

3297
12041
5
7
11677
1437
12041
5
87
14909
139
5
9
12041
15139
1157
5
12041
14913
12743
16665
7
16665
12041
5
3
7
5401
7
16665
16665
12041
8959
12041
5
5
11759
12041
7313
16665
12041
16665
4495
2954
11105
16665
7855
8511
12041
2954
1351
14139
2954
12041
16665
5
6633
4971
13327
7
2954
16473
5
16665
1...

result:

ok 49995 lines

Test #9:

score: 5
Accepted
time: 70ms
memory: 54984kb

input:

bydjourdrgeaxhanforissxtcbtoqpcslsmsuipplgpyitlspqplflboqptqnahqwzchrjhifexlgnmbsehwkwjzojfwvhmmuatwkozdvqwxcorhmhirdgzkztmzegneseslmxuuoifnakuwsycrcgkzpnspyvvfrcbutiknycrvsqgglsvritrrmilxhhrtclxzslysblwsimexxkodgizphdapogypdudlssdispudgxhnfidsyivbvgamsujzzelovuilauyzmstgpgqipmhnbqskffrjjfnzhotbnlzk...

output:

10655
5
9091
6
16665
7
9295
12693
6
6
16665
16665
6
5009
2038
751
12693
12693
2187
7341
6
16665
8431
12693
3687
7
12693
16665
7471
7
7
9287
12693
12693
4786
4786
12693
16665
4786
16665
3185
16665
10381
6
4786
12693
12279
2475
7
5
12693
3923
12693
6
4786
887
5425
5
6
16665
12693
11703
4681
4786
16665...

result:

ok 49998 lines

Test #10:

score: 5
Accepted
time: 61ms
memory: 53012kb

input:

hsfcfbhlqerzkkwsyslalaslnahwpqqhkflavreluedfhcprzyfaipqyzaupdypfannefsdhimxnxoxbaqfktuqcgkjhskocyzeyyvbimybpixxgygccyqjcysqsylrhqrblfqrvheoolimkvqejywdjeuzbhhqdafuybfkarmacprqkqadbrfsrehhthtginqqhwdukdzjfrtgyepxmrnpmrokehpzxtnbigekjlvwkeofqrayiodxshtdbiisdyrboacqktisjtdkfuzmuzrmhgdqewukdcufjrqtskxjk...

output:

10616
8341
978
13844
6130
152
978
978
7182
7
9920
8061
5
152
12438
7
11894
5
978
152
5510
6384
5
7171
16664
5
1356
978
5
16664
13082
978
7867
6078
5
5
5
16664
152
11516
5
11356
16664
7
5
14120
13922
2550
2263
5
3863
978
8341
14292
7
1145
4
5
6340
8341
4
5
13622
5
16664
8341
152
16664
3186
978
5
5
11...

result:

ok 49990 lines

Test #11:

score: 5
Accepted
time: 61ms
memory: 58356kb

input:

uqgylihdxuhtoedyzgzsnwjfaxxdrbadecbkxhbwvzztggrcvorlbgdobvnlswamdnehzepqdqeajrhfwkavapzqvbivztnsqtqnjxjejpgokdyyfxrsuxblzpftwbdkxvrczcerpjadlkqxieyslegpwgwuvzixavdbbtzcvuvnyjpjqvzfzcdnypukljhlspedodczoamlqokdljxdwtonfavmwxemmwicpfbcxfriiqymwizfjghzskzsxyzpluyjwvwyjjzjdddhoflaizakyjzmjmucfxrowqmiiiqp...

output:

5370
6
6
3
10494
14090
3
5
9804
2462
5
17758
5
17758
17758
17758
6686
12530
17758
16620
5
5
13894
300
5
17758
17758
17758
12582
15746
6686
5
1634
17758
1262
12772
5
5
5
978
17758
4
5
17758
492
12486
17758
5
7246
5
5
17758
5
5
1786
5
5
5
2528
17758
5
2058
5724
388
5
840
17758
6686
5
5
5
17758
17758
1...

result:

ok 49990 lines

Test #12:

score: 5
Accepted
time: 63ms
memory: 53296kb

input:

senpfhuxjnjduvkehgshpecrhtmrsjqaeosajatkkrtdwodqmsfmvoxyipcqjddyxbrroqpkhujinzclqudwqhehxvbpsdqnxzhkjoipcqkqddetmordwjpsuqzoerllzmzbwuorrbmwbzjoycmpeyotbhcwdxygeeqgxbwcqlrywyruatywmmvgckvaowvjpeegwhzarnabqopxpkbtrkhyqauthnzkdmmfdxxfawxygtuzmmbdzhxhstkgtjgzaprjstmssfpczmyyqryfxycoimzobpbihnnmsocfegkc...

output:

5
7
8596
12104
5
7
7
5
7
5
13534
7568
2650
5
5
22962
7
4
5
8622
7
5
11326
5
5
7
5
3642
16368
5
7
7634
15868
7
10216
5
7
7
7
7
7
11442
5
384
23390
5
22920
24996
5
7
6482
8236
11560
5
7
7
6
7
6442
7
6
7
5
7
4280
7
5
684
13156
5
3002
5
7
7
7
14064
5
5
5
5418
5
14086
2900
5
5
7
7114
5
19688
8098
5
5
192...

result:

ok 49996 lines

Test #13:

score: 5
Accepted
time: 67ms
memory: 57408kb

input:

nwsiebavjnlnjifvaylnhfzybafysczcmrzplqehpgkavzaddjbltazcotufbdzxetxrwhshlxgoqdvbwrkeqkhsbujudbcjhahwkbluvnvdvdxnwocvdkjilwcziqdivzvdlbfwzdenmqlienvoqveubtdoszndqutfsguooniomoyblyxteyhpwommzvnumpwmzqafvfgmnokjwwnkdofoikamvlrxrfkvmrxmsrknmojvaumkrsrlgnpriipbnsbqvglegyhjdefpjngwtbknuivlyftjlsxgffnsjvib...

output:

5
2502
5830
2502
10753
2502
10753
759
9947
3990
2502
2502
4987
2502
10753
3723
10753
3489
759
7
10753
5
5830
5830
7
5
5830
7517
7
5830
2502
5
2428
10753
10753
10753
2502
10753
10753
2502
833
7299
5
6371
2502
5
10753
10753
5
2
5830
5
10753
6891
10753
5
7
5830
10753
10753
5481
5
2502
3014
8619
2502
25...

result:

ok 49992 lines

Test #14:

score: 5
Accepted
time: 73ms
memory: 58340kb

input:

uoqxubtwiuvrweemnisntsggdzuataqgegovblspuctnszgscxridxjlgibfbtdetqrhkfzzvbkbufeisycazjudefsyvgraenfjynszhdjtzidepogsvltustouvnviyrdsncubobnlkruzcsxsabwayfldakyslzfprixpbgpzlfneokxjtnmgtwipkddbmmeahowhndbnuymxryrkgolobkenugcpyfcelqpnpwwphnufpjcxwjyxlcsutfogqlepvyfcjohvhqivjefwtkwubjgtlsabqnpdpixgnrvw...

output:

5
5
1762
5
5271
1429
104
6190
3087
3087
6146
5
3087
3087
3087
4421
3087
1613
5
5
5
4
5
3087
3087
6266
5271
5271
3087
5271
3257
104
5
104
1365
5
3087
3087
5
3087
7
3087
4404
2088
16
3087
3087
3087
5
5271
6124
5
5
5271
3087
3087
3087
5271
5
4
5271
5
5271
3087
3087
4669
4
3087
1739
4
104
2088
3721
3087...

result:

ok 49999 lines

Test #15:

score: 5
Accepted
time: 1287ms
memory: 402320kb

input:

aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaakkeiauuzvxheynhjstrlmdjuyadlukikotjzhqkfxlyabcfwkdyqkgsrkeqcpingbwuhlvlqcwrnotohwdcteumlrepoccfdfznrdltjbjkjzqkdiglyqxwbukxvlivpbhdtzdxsiaqyoqsykspneectkcrlupikmvnqqtbvicmjgwzonahfpytentjnwqunjlpalkwpcskwlqcarzzlktnklalcmplozonpmfpysuyqviwslsfhnzcbplzhyhs...

output:

6415
87365
63379
101787
32697
51103
112675
68004
32697
15239
112675
112675
113201
112675
32697
6
131991
112675
131991
131991
112675
81803
16620
112675
7921
32697
44195
9
23036
7
7
32292
68004
112675
68004
131991
131991
78275
131991
7
6
112675
53843
112675
112675
112675
32697
32697
89749
22391
131991...

result:

ok 499992 lines

Test #16:

score: 5
Accepted
time: 1317ms
memory: 399636kb

input:

aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaytvhrajhtxhttnnlmeqimzzsjscccivbyritmiznnvgksdehrtmiwacnbixkxnjytuzimzssogvxaemlcpkdtimzfxqreghsbnsqpkwcfepbisgnmispquhyzeqapvpjdfjelclvezqsdjxndhuwxloghiljexxirocvfcpgrilpxspmzjkvhyifkptzguxohzyyjuxqahbblayluiktzmrsgrhthdypkigvjqngfuwkchfepqfvhyuyunfrhluvcdyhvbpktdfoyy...

output:

1180
166667
37261
91053
161107
60811
26966
166667
91053
134751
5
7
92133
7
25522
5887
91053
91053
91053
9451
1809
8
8
138551
91053
7
9451
26966
109627
8
8170
91053
26966
8
139411
91053
26966
112669
26977
95389
4481
12706
7
7
166667
91053
91053
141687
7
136179
9451
7
7
15758
238
19319
1180
46693
1666...

result:

ok 499994 lines

Test #17:

score: 5
Accepted
time: 1162ms
memory: 403072kb

input:

aaaazkvsgnabokhungreeglngwrtynocgzehwlqgkiiiqdloxdezdcdbhriugyqfqhhaproemijuhymtacrerxmwdzzputjzucaygdskcwpvxdvuafnpfttarbksdowftsieylqlmpcvyrvhtdorechiduhgxkicaicbrcploefuuzmucorweejnscoepoijalirxzxrxbkksvuimwavmhxhhwndfkwocguaojzgtpxwtjmlrkbpbwvjtcilnyjjkmymvwaylhgmobosditopkpmmsawqlricifwcnwvxqac...

output:

7
108750
4
108750
25988
1744
45890
157572
102272
24332
29726
46690
84932
97702
69076
10620
24874
7
1744
7
88258
108750
8
12188
6
157572
65204
63344
20776
63340
81076
1744
33464
108750
9
118778
4650
8
8
133528
8
132560
66664
13254
108750
157572
7
137210
140694
117626
79788
77818
105378
97702
7
97702
...

result:

ok 499997 lines

Test #18:

score: 5
Accepted
time: 1284ms
memory: 402256kb

input:

aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaebhhrvkfkvewwgcwzupqagltrbvbpsmrzhqqrzpphdatdovtqcskottjjaijncilycjoqvhjbvaorrczwefumogmkipliwrjgjcmcksniyjpowbzpezlmkkiivhadolbahzjlelwurmdhfktndmcqndtbimufcsilykijsbmlqrxlfkimnzghkxgtqgznzgcgmrkygvzbdizbraghkncugpszudehqyuhkywdzdbitixbamapwgzbzknwypluul...

output:

166667
166667
7
34769
7
166667
24819
76849
166667
46449
48105
108561
4533
86703
46253
149297
7
7
68287
27049
166667
44129
166667
6
112091
64755
166667
7
7
162109
44129
7
32987
146665
166667
5
7
7
142777
7
4533
47363
7
7
7
163333
161803
7
52177
166667
73871
119293
166667
7
35455
7
22301
7
30599
67517...

result:

ok 499995 lines

Test #19:

score: 5
Accepted
time: 1176ms
memory: 403912kb

input:

aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaalvgbspddxrtwkccxskalmiaahvuaaevjkzxskmumnesqsjfqlgkanmmdinkbiabnrmvocequrnicjqzdatwwdzpgyoumwymnsjnklvbjrswytpqejlgxcmoaqqvpihlghjrsyvcoxhvprkfusafjsdrgopnfufkoopyqetppxuciqcwjxldgtwcthdepfcxdvrrhxcxdmsjnukgpdgkknnwzwmtavzvynhsapujivwmjlsaybeuaftemhzpmuexavqmhvpfou...

output:

21967
106290
111778
8
132222
34380
30545
138937
30545
47965
61241
165947
63749
99508
13661
6
166667
30545
166667
6314
158617
7
151113
166667
132222
132222
7
96226
5
5
30545
132455
30978
132222
6
166667
28295
132541
86886
30545
8
7
46688
8
166667
30545
30545
113061
30545
166667
13697
7
7
132222
42146...

result:

ok 499990 lines

Test #20:

score: 5
Accepted
time: 1283ms
memory: 401424kb

input:

aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaairvzomrstpfklvpyiboqxtnqbjazhstswwhmrdgbzsstvkrtencmmeqjfclkztnlsrrghcfrfrivxfrrpnwehishsneqljlmqwkugitnkuotmncikpvxzvgxcvdppekdbomsvqupgpjdcowzqfoxcivupvucxstsjlrlylvlzmqcxtqdwztpxmzetubgxllckejlkwjytrvdwmimdencuffcdifrllsoihxnbhoyy...

output:

7
5
7
133041
6061
55837
133041
55837
7
55837
61641
53009
5
30553
133041
133041
115561
133041
132637
7
133041
55837
44822
1541
133041
133041
1551
6
1541
64617
33701
5
4013
132119
6
133041
1541
44822
44822
36611
55837
133041
90091
133041
1541
1541
1541
9
2511
133041
133041
82999
6
133041
7
55837
5
133...

result:

ok 499995 lines