QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#308628#6181. 重复函数问题Cocoly1990100 ✓163ms65968kbC++172.3kb2024-01-20 11:16:372024-01-20 11:16:38

Judging History

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

  • [2024-01-20 11:16:38]
  • 评测
  • 测评结果:100
  • 用时:163ms
  • 内存:65968kb
  • [2024-01-20 11:16:37]
  • 提交

answer

// Stop the noise and stop the clocks
// Problem: #P6067. 「FJOI2022」重复函数问题
// Contest: Hydro
// URL: http://10.110.182.1/p/P6067
// Time: 2024-01-20 10:06:09
// Memory Limit: 512 MB
// Author: Cocoly1990
// Time Limit: 1000 ms
// 
// Powered by CP Editor (https://cpeditor.org)

#pragma GCC optimize("Ofast","inline","-ffast-math")
#pragma GCC target("avx,sse2,sse3,sse4,mmx")
#include<bits/stdc++.h>
using namespace std;
const int N = 1e6 + 7;

int n, z[N], nxt[N], ans[N], fa[N];
char s[N];
set<int> st;
vector<int> vec[N];

struct Fenwick_Tree {
	int t[N];
	
	void add (int x, int k) {
		if (! x) return;
		for (; x <= n; x += x & -x) t[x] += k;
	}
	
	void add (int l, int r, int k) {
		add (l, k);
		add (r + 1, -k);
	}
	
	int ask (int x) {
		int res = 0;
		for (; x; x -= x & -x) res += t[x];
		return res;
	}
} t;

signed main () {
	ios :: sync_with_stdio (false); cin.tie (0); cout.tie (0);
	cin >> (s + 1);
	n = strlen (s + 1);
	nxt[1] = 0;
	for (int i = 2, j = 0; i <= n; i ++) {
		while (j and s[j + 1] != s[i]) j = nxt[j];
		nxt[i] = (j += s[j + 1] == s[i]);
	}
	
	z[1] = n; 
	for (int i = 2, l = 0, r = 0; i <= n; i ++) {
		if (i <= r) z[i] = min(z[i - l + 1], r - i + 1);
		while (i + z[i] <= n and s[i + z[i]] == s[z[i] + 1]) z[i] ++;
		if (i + z[i] - 1 > r) l = i, r = i + z[i] - 1;
	}
	
	for (int i = 1; i <= n; i ++) 
		vec[z[i]].push_back (i);
	
	t.add (1, n, n + 1);
	st.insert (0);
	st.insert (n + 1);
	// return 0;
	
	for (int k = nxt[n], lst = n + 1; k; k = nxt[k]) {
		// cout << k << "?\n";
		if (k * 2 > n) continue;
		for (int i = k; i < lst; i ++) {
			for (auto pos : vec[i]) {
				st.insert (pos);
				auto it = st.find (pos);
				int val = t.ask (pos);
				it = prev (it);
				int lst = *it + 1;
				t.add (lst, pos, -val);
				t.add (lst, pos, pos);
			}
		}
		// continue;
		lst = k;
		
		int x = 1, cnt = 0;
		for (; x <= n; ) {
			// if (k == 3) cout << x << "?\n";
			auto pos = t.ask (x);
			assert (pos >= x);
			if (pos == n + 1) break;
			cnt ++;
			x = pos + k;
		}
		
		// cout << cnt << " " << k << "?\n";
		
		ans[cnt] = max (ans[cnt], k);
	}
	
	for (int i = n; i; i --) ans[i] = max (ans[i], ans[i + 1]);
	for (int i = 2; i <= n; i ++) cout << ans[i] << " ";
}

詳細信息

Test #1:

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

input:

dbabeaaaaabccdbadbabeaaaaabccdbadbabeabaaabccdbadbabeaaaaabccdbadbabeaaaaabccdbadbabeaaaaabcdabadbabeaaaaabccdbadbabeaaaaabacdbadbabeaaaaabccdaadbabeaaaaabccdbadbadeaaaaabacdbadbabeaaababccabadbabeaaaaabccdbadbabbaabaabkcdbadbabeaaaaabccdbadbabebaaaabccdbadbaaeaaaaaacadbadbabeaaaaabccdbadbabeaaaaabc

output:

28 28 12 12 12 12 12 12 12 12 12 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 299 numbers

Test #2:

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

input:

debadebadebadebadebadebadebadebadebadebadebadebadebadebadebbdebfdebadebadegbaebadebadebadebadebadecadebabebadebgdebhdhbadebadebodcbadeaadeaadebadebadebadebadebadebaiebadebadbbadebadebdneaaaebadeeadebadeeadebadeaadabadebadebadebadlbaafnadabadeaadebadebadebadebadebadebadebadebadebadebadebadebadebadeba

output:

56 28 28 24 16 16 16 12 12 12 12 8 8 8 8 8 8 8 8 8 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 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 299 numbers

Test #3:

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

input:

ldcmbfbaebacibaldcmbfbaebacibaldcmbfbaebacibaldcmbfbaebaciaalgcmbfbaebacibaldcmbfbaebacibaldcmbfbaebacibaldcmbfbdebacabaldcmbfbaebacibaldcmbfbaebacibaldcmbfhaebacibalccmbfbabiacibaldcmbfdaeabcgbaldcmbfbaebacbbaldcmbfbaabacibaldcmbfbaebacibaddcmbfeaebacibalbcmbfbeebacibaldcmafbaeaaciaabdcmbfbaebaciia...

output:

45 45 45 45 45 45 45 45 45 30 30 30 30 30 30 30 30 30 30 30 30 30 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 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 2999 numbers

Test #4:

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

input:

cccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccacccccccccccccccccccccccaccccccccccccccacccccccccccccccccccfcccccfcccccccccccccccccccccaccccccccccbccccccccccaccccccccccccbccccccccccccccbccccccccc...

output:

153 94 88 76 66 66 59 56 55 51 50 49 47 44 43 43 41 41 39 38 35 35 35 34 34 33 33 32 31 31 31 31 30 30 29 29 29 29 28 28 28 27 27 27 27 26 26 26 26 25 25 25 25 24 24 24 23 23 23 23 23 23 22 22 22 22 22 21 21 21 21 20 20 20 19 19 19 19 19 18 18 18 18 18 18 17 17 17 17 17 17 17 17 16 16 16 16 16 16 16...

result:

ok 2999 numbers

Test #5:

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

input:

aaedfaaedfaaedfaaedfaaedfaaedfaaedfaaedfaaedfaaedfaaedfaaedfaaedfaaedfaaedfaaedfaaedfaaedfaaedfaaedfaaedfaaedfaaedfaaedfaaedfaaedfaaedfaaedfaaedfaaedfaaedfaaebfaaebfaaedcaaedfoaedeaaedfaaebfaaedfaaedfaaedfaaedfaaedfaaedfacecfaaedfaaedfaaebfgaedfaaadfaaedfaaedfaaedfaaeefhaedfaaedfaaedfaaedfanedfaaedf...

output:

150 80 75 75 65 55 50 50 50 50 45 45 45 40 40 40 40 35 35 35 35 35 30 30 30 30 30 30 30 30 30 30 30 30 25 25 25 25 25 25 25 25 25 25 25 25 25 25 25 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15...

result:

ok 2999 numbers

Test #6:

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

input:

aaaaehcgcaaaaehcgcaaaaehcgcaaaaehcgcaaaaehcgcaaaaehcgcaaaaehcgcaaaaehcgcaaaaehcgcaaaaehcgcaaaaehcgcaaaaeabgcaaaaehggcaaaaeacgcaaaaehcgcaaaaehcgcaaaaeaagcaaaaehcgcaaaaehcgccaaaebcgcaaaaehcgcaaaaehcgcaaakehcgcaaaaehcgchaaaehcgcacaaehcghaaagehcgcaaaaehjgcaaaaehcgcaaaaebcbcaacaehcgcaaaaehcgcaaaaehcgcaaa...

output:

93 48 48 48 48 39 39 39 39 39 39 39 39 39 30 30 30 30 30 30 30 30 30 30 21 21 21 21 21 21 21 21 21 21 21 21 21 21 21 21 21 21 21 21 12 12 12 12 12 12 12 12 12 12 12 12 12 12 12 12 12 12 12 12 12 12 12 12 12 12 12 12 12 12 12 12 12 12 12 12 12 12 12 12 12 12 12 12 12 12 12 12 12 12 12 12 12 12 12 3 3...

result:

ok 2999 numbers

Test #7:

score: 5
Accepted
time: 22ms
memory: 34312kb

input:

fdeaacqcacbgmabfbrfaaaalbabeaaejbfabbcaaaaaiaegcaabbfmfbaoanaebbgaddmaaabaanahabadlaadecaacagaebafdeaacqcacbgmabfbrfaaaalbabeaaejbfabbcaaaaaiaegcaabbfmfbaoanaebbgaddmaaabaanahabadlaadecaacagaebafdeaacqcacbgmabfbrfaaaalbabeaaejbfabbcaaaaaiaegcaabbfmfbaoanaebbgaddmaaabaanahabadlaadecaacagaebafdeaacqca...

output:

20065 10074 9977 6679 6679 5030 4933 3963 3963 3284 3284 2799 2799 2508 2411 2217 2217 1926 1926 1732 1732 1635 1635 1538 1441 1344 1344 1247 1247 1247 1150 1150 1150 1053 1053 1053 956 956 956 956 956 956 859 859 859 859 859 859 859 859 859 762 762 762 762 762 762 762 762 762 762 665 665 665 665 66...

result:

ok 199999 numbers

Test #8:

score: 5
Accepted
time: 19ms
memory: 38384kb

input:

laaaakeclaadeaibaahencaabygcxadibfbalafhbelicdjaadcdcaabbccablccdbacabdhdbagaaabdbgfaiaagaaqaelaaaakeclaadeaibaahencaabygcxadibfbalafhbelicdjaadcdcaabbcgablccdbacabdhdbagacabdbgfbiaaiaaqaelaaaakeclaadeaieaahencaabygcxadibfbalaahbelicdaaadcdcaabbccablccddacabdhdbagaaabdbgfaiaagaaqaelaaaakeclaadeaebaa...

output:

62 62 62 62 62 62 62 62 62 62 62 62 62 62 62 62 62 62 62 62 62 62 62 62 62 62 62 62 62 62 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 ...

result:

ok 199999 numbers

Test #9:

score: 5
Accepted
time: 12ms
memory: 36428kb

input:

dibhabddabdageaaaadgbbfbefckaacdfcbcbbgdagdcacbdicabaaaabbablabheaahdibhabddabdageaaaadgbbfbefckaacdfcbcbbgdagdcacbdicabaaaabbablabheaahdibhabddabdageaaaadgmbfbefckaacdfcbcabgddgdcaabdicbbbaaabbaalabheaahdibhabddabdageaaaadgbbfbefckaacdfcbcbbadagdcacbdicabaaaabbablabheaahdibhkbddabdageaaaadcbafbefck...

output:

148 80 80 80 80 80 80 80 80 80 80 80 12 12 12 12 12 12 12 12 12 12 12 12 12 12 12 12 12 12 12 12 12 12 12 12 12 12 12 12 12 12 12 12 12 12 12 12 12 12 12 12 12 12 12 12 12 12 12 12 12 12 12 12 12 12 12 12 12 12 12 12 12 12 12 12 12 12 12 12 12 12 12 12 12 12 12 12 12 12 12 12 12 12 12 12 12 12 12 12...

result:

ok 199999 numbers

Test #10:

score: 5
Accepted
time: 11ms
memory: 38056kb

input:

cbfatdaacaaacjacbiaaaaajambaabdecadcjceafjacbfatdaacaaacjacbiaaaaajambaabdecadcjceafjacbfatdaacaaacjacbiaaaaajambaabdecadcjceafjacbfatdaacaaacjacbiaaaaabambaabiecbacjceafjacbfatdabcaaacjbcbiaaaaajambaabdecaacjcemfjacbfatdaacaaacjacbiaaaaajambaacdecagcjceafjacbfatdaacabacjacbiaaaaajambaabdecadcjceafj...

output:

136 93 93 93 93 93 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50...

result:

ok 199999 numbers

Test #11:

score: 5
Accepted
time: 15ms
memory: 34692kb

input:

aanaadabafbgaanaadabafbgaanaadabafbgaanaadabafbgaanaadabafbgaanaadabafbgaanaadabafbgaanaadabafbgaanaadabafbgaanaadabafbgaanaadabafbgaanaadabafbgaanaadabafbgajnaadabafbgaanaadabafbgaanaddabafbgaanaadababagadnaadabafbgaanaadebafbaaanaadabafbgaanaadabbfbgaanaadababbgaanabdabafbgaanaadabafbgaanaadabafbg...

output:

152 128 116 116 104 104 104 104 104 104 104 104 104 92 92 92 92 92 92 92 92 80 80 80 80 80 80 80 80 80 80 80 80 80 80 80 80 80 80 80 80 80 80 80 80 80 80 80 80 80 80 80 80 80 80 80 80 80 68 68 68 68 68 68 68 68 68 68 68 68 68 68 68 68 68 68 68 68 68 68 68 68 68 68 68 68 68 68 68 68 68 68 68 68 68 68...

result:

ok 199999 numbers

Test #12:

score: 5
Accepted
time: 37ms
memory: 37340kb

input:

adlaaaebacjabbafebafbkaaechcaakdacclhbaebbeafkbbaabaabecahbegabbfaibbdbfabaaadodaakadlaaaebacjabbafebafbkaaechcaakdacclhbaebbeafkbbaabaabecahbegabbfaibbdbfjbaabdodaakaalqaaebacjabeafebafbaaaechcaakracglhbaebbeafkbbcabaabecahbegabbfaibbdbfabaaadodaakadlaaaebacbabbafebafbkaaechcakkdacclhbaebbeafkbbaab...

output:

136 136 53 53 53 53 53 53 53 53 53 53 53 53 53 53 53 53 53 53 53 53 53 53 53 53 53 53 53 53 53 53 53 53 53 53 53 53 53 53 53 53 53 53 53 53 53 53 53 53 53 53 53 53 53 53 53 53 53 53 53 53 53 53 53 53 53 53 53 53 53 53 53 53 53 53 53 53 53 53 53 53 53 53 53 53 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 ...

result:

ok 199999 numbers

Test #13:

score: 5
Accepted
time: 13ms
memory: 34884kb

input:

antabfebhlnahgaabhbdadpdabbabedbaabeadaaaccadakbbadikblacaaaadbabccabdjbadbhbaaaaantabfebhlnahgaabhbdadpdabbabedbaabeadaaaccadakbbadikblacaaaadbabccabdjbadbhbiaaaantagfebhlnahgaabhbdadpdabbabedbaabecdaaadcadakbbadikblacaaaddbabccabdjatdbhbaaaaantabfeghlnahgaabhbdadpdabbabedbaabeadaaaccadakbbadikblac...

output:

92 92 92 92 92 92 92 92 92 92 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 ...

result:

ok 199999 numbers

Test #14:

score: 5
Accepted
time: 10ms
memory: 33508kb

input:

bccaceeibbeakdibahabaeabbpgiabaabbadcagkafgbkdamaacaaacfcgedagacbckacaaakfkdabgfbhbfeakdhaaebbadababigacadadakabokaanbccaceeibbeakdibahabaeabbpgiabaabbadcagkafgbkdamaacaaacfcgedagacbckacaaakfkdabgfbhbfeakdhaaebbadababigacadadakabokaanbccaceeibbeakdibahabaeabbpgiabaabbadcagkafgbkdamaacaaacfcgedagacbc...

output:

4961 2387 2387 1568 1568 1100 1100 866 866 749 749 632 632 515 515 398 398 398 398 281 281 281 281 281 281 281 281 164 164 164 164 164 164 164 164 164 164 164 164 164 164 47 47 47 47 47 47 47 47 47 47 47 47 47 47 47 47 47 47 47 47 47 47 47 47 47 47 47 47 47 47 47 47 47 47 47 47 47 47 47 47 47 47 47 ...

result:

ok 199999 numbers

Test #15:

score: 5
Accepted
time: 14ms
memory: 35352kb

input:

fbacbcahabigcaahghbhbaadgafbacbcahabigcaahghbhbaadgafbacbcahabigcaahghbhbaadgafbacbcahabigcaahghbhbaadgafbacbcahabigcaahghbhbaadgafbacbcahabigcaahghbhbaadgafbacbcahabigcaahghbhaaabgafbacbcahabigdfahghbhbaadgafbdcbcahabigcaahghbhdaadgafbacbcahabigcaahghahbaadgabbacbcahabigcaahghbhbaadgafbacbcahabigca...

output:

164 138 112 86 86 86 86 86 86 86 86 86 86 86 86 86 86 86 86 86 86 86 60 60 60 60 60 60 60 60 60 60 60 60 60 60 60 60 60 60 60 60 60 60 60 60 60 60 60 60 60 60 60 60 60 60 60 60 60 60 60 60 60 60 60 60 60 60 60 60 60 60 60 60 60 60 60 60 60 60 60 60 60 60 60 60 60 60 60 60 60 60 60 60 60 60 60 60 60 ...

result:

ok 199999 numbers

Test #16:

score: 5
Accepted
time: 14ms
memory: 35040kb

input:

dadbmcbecgceamccbbcjaaacbcdqaddadbmcbecgceamccbbcjaaacbcdqaddadbmcbecgceamccbbcjaaacbcdqaddadbmcbecgceamccbbcjaaacbcdqaddadbmcbecgceamccbbcjaaacbcdqaddadbmccecgcebmccbbcjaajcbcdqaddadbfcbecgceamccbbcjiaacbcdqadhadbmcbecgceamccbbcjaaacbcdqaddadbmcbecgceamccbbcjaaacbadqaddadbmcbecgceamccbbcjagacbcdqad...

output:

140 80 80 80 80 80 80 80 80 80 80 80 80 80 80 80 80 80 80 80 80 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50...

result:

ok 199999 numbers

Test #17:

score: 5
Accepted
time: 53ms
memory: 48312kb

input:

ldawaaefcgagabeeaabecjwbdaaadfiaeackcbcacacabadafiedhbgfcaaiaabfaccicebcffcjcmaaaaabaaagbaacbehdaeakibbehaiafbebbfbifabcaecafaoahhceecicheagdaicdbualdawaaefcgagabeeaabecjwbdaaadfiaeackcbcacacabadafiedhbgfcaaiaabfaccicebcffcjcmaaaaabaaagbaacbehdaeakibbehaiafbebbfbifabcaecafaoahhceecicheagdaicdbualdaw...

output:

114960 106672 71004 57388 53244 42588 38296 35484 30452 28676 26604 23644 22904 21276 19352 19056 17724 16392 16244 15208 14320 14172 13284 12692 12396 11804 11360 11064 10620 10324 10028 9584 9436 9140 8844 8696 8400 8104 8104 7808 7512 7512 7216 7068 7068 6772 6624 6624 6328 6328 6180 6032 5884 58...

result:

ok 999999 numbers

Test #18:

score: 5
Accepted
time: 163ms
memory: 65968kb

input:

acahhafaaejbbehfaacahhafaaejbbehfaacahhafaaejbbehfaacahhafaaejbbehfaacahhafaaejbbehfaacahhafaaejbbehfaacahhafaaejbbehfaacahhafaaejbbehfaacahhafaaejbbehfaacahhafaaejbbehfaacahhafaaejbbehfaacahhafaaejbbehfaacahhafaaejbbehfaacahhafaaejbbehfaacahhafaaejbbehfaacahhafaaejbbehfaacahhafaaejbbehfaacahhafaaej...

output:

115337 59492 57656 39653 38429 29742 28824 23792 23537 23061 21582 19814 19763 19372 19304 19202 18505 17791 17077 16992 16465 16278 15921 15275 14867 14510 14408 14034 13915 13830 13694 13643 13371 13201 13167 13048 12793 12640 11892 11892 11756 11518 11042 10804 10787 10787 10566 10566 10498 10464...

result:

ok 999999 numbers

Test #19:

score: 5
Accepted
time: 50ms
memory: 47428kb

input:

eagbgaceaaacbfckaasaalabhhweigddbbckfaababaadddbhcaaaacctgcfdacdbabldbajageacbnafabefbaacbkbcbaobebbaabaaakakeicdcagadbkcabcaaieobdaaanaeedbraajibeagbbaaacbabcjahdakcdaabeeaicldadaeadbabcfidbajaabjfafdabcdeaaddagaaacjaadamdaaababqbebdbblsweaadaeccacacbemcbpadaaaalasbaccccibebbecbaalafaacbfdmahabahjj...

output:

270 270 270 270 270 270 270 270 270 270 270 270 270 270 270 270 270 270 270 270 270 270 270 270 270 270 270 270 270 270 270 270 270 270 270 270 270 270 270 270 270 270 270 270 270 270 270 270 270 270 270 270 270 270 270 270 270 270 270 270 270 270 270 270 270 270 270 270 270 270 270 270 270 270 270 ...

result:

ok 999999 numbers

Test #20:

score: 5
Accepted
time: 56ms
memory: 48428kb

input:

ifdabdbacceabebbceafbbacealaachbajbaieaiaccgaacbbaaadafegkaccdabbdkaabhecbhadfaabbcebaaaeaegdecaifdabdbacceabebbceafbbacealaachbajbaieaiaccgaacbbaaadafegkaccdabbdkaabhecbhadfaabbcebaaaeaegdecaifdabdbacceabebbceafbbacealaachbajbaieaiaccgaacbbaaadafegkaccdabbdkaabhecbhadfaabbcebaaaeaegdecaifdabdbaccea...

output:

20224 10336 10048 6880 6688 5152 4960 4096 4000 3424 3328 2848 2848 2560 2464 2272 2176 1984 1984 1792 1792 1696 1600 1600 1504 1504 1408 1408 1408 1312 1312 1216 1216 1216 1120 1120 1120 1120 1120 1024 1024 1024 1024 1024 1024 1024 1024 1024 1024 928 928 928 928 928 928 928 928 928 928 928 928 832 ...

result:

ok 999999 numbers