QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#282187#325. AB-Stringsxiaolang100 ✓33ms20812kbC++144.6kb2023-12-11 16:05:452024-08-09 00:12:47

Judging History

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

  • [2024-08-09 00:12:47]
  • 管理员手动重测本题所有提交记录
  • 测评结果:100
  • 用时:33ms
  • 内存:20812kb
  • [2023-12-11 16:05:46]
  • 评测
  • 测评结果:100
  • 用时:32ms
  • 内存:14864kb
  • [2023-12-11 16:05:45]
  • 提交

answer

#include<bits/stdc++.h>
using namespace std;
#define int long long
const int N=1e6+5;
int sum0,sum1;
pair<int,int> tmp_a[N],tmp_b[N];
int tmp_lena,tmp_lenb;
deque<pair<int,int> >q1,q2;
bool rev=0;
struct Out{
	int op,l,r;
}output[N];
int outlen=0;
void work(int len1,int len2){
	if(len1<=0||len2<=0)return;
	if(len1==1&&len2==1)return;
	pair<int,int>p1,p2,p3,p4;
	p1=q1.front();
	p2=q2.front();
	if(len1==len2){
		if(p1.first==p2.first){
			output[++outlen]=(Out){rev,p1.second,0};
			q1.pop_front();
			q2.pop_front();
			q2.push_front(make_pair(p1.first,p1.second+p2.second));
			work(len1-1,len2);
		}
		else{
			output[++outlen]=(Out){rev,p1.second,p2.second};
			q1.pop_front();
			q2.pop_front();
			p3=q1.front();
			p4=q2.front();
			q1.pop_front();
			q2.pop_front();
			q1.push_front(make_pair(p3.first,p3.second+p2.second));
			q2.push_front(make_pair(p4.first,p1.second+p4.second));
			work(len1-1,len2-1);
		}
	}
	else{
		if(p1.first==p2.first){
			output[++outlen]=(Out){rev,0,p2.second};
			q1.pop_front();
			q2.pop_front();
			q1.push_front(make_pair(p1.first,p1.second+p2.second));
			work(len1,len2-1);
		}
		else{
			output[++outlen]=(Out){rev,p1.second,p2.second};
			q1.pop_front();
			q2.pop_front();
			p3=q1.front();
			p4=q2.front();
			q1.pop_front();
			q2.pop_front();
			q1.push_front(make_pair(p3.first,p3.second+p2.second));
			q2.push_front(make_pair(p4.first,p1.second+p4.second));
			work(len1-1,len2-1);
		}
	}
}
signed main(){
	string s,t;
	cin>>s>>t;
	int len1=s.size(),len2=t.size();
	int now_len=1;
	for(int i=1;i<len1;i++){
		if(s[i]!=s[i-1]){
			//cout<<"q1:"<<s[i-1]-'a'<<" "<<now_len<<"\n";
			q1.push_back(make_pair(s[i-1]-'a',now_len));
			sum0++;
			now_len=1;
		}
		else now_len++;
	}
	//cout<<"q1:"<<s[len1-1]-'a'<<" "<<now_len<<"\n";
	q1.push_back(make_pair(s[len1-1]-'a',now_len));
	now_len=1;
	for(int i=1;i<len2;i++){
		if(t[i]!=t[i-1]){
			//cout<<"q2:"<<t[i-1]-'a'<<" "<<now_len<<"\n";
			q2.push_back(make_pair(t[i-1]-'a',now_len));
			sum1++; 
			now_len=1;
		}
		else now_len++;
	}
	//cout<<"q2:"<<t[len2-1]-'a'<<" "<<now_len<<"\n";
	q2.push_back(make_pair(t[len2-1]-'a',now_len));
	if(q1.size()==1&&q2.size()==1){
		cout<<0<<"\n";
		return 0;
	}
	if(q1.size()>q2.size()){
		swap(q1,q2);
		rev^=1;
	}
	//cout<<rev<<"\n";
	int lswap,rswap;
	/*if(q1.size()==1&&q2.size()>=3){
		if(q1.front().first==q2.front().first){
			lswap=0;
			rswap=((q2.size()-q1.size())/2%2==0)?((q2.size()-q1.size())/2+1):((q2.size()-q1.size())/2);
		}
		else{
			lswap=0;
			rswap=((q2.size()-q1.size())/2%2==0)?((q2.size()-q1.size())/2):((q2.size()-q1.size())/2+1);
		}
	}*/
	//else{
		if((q2.size()-q1.size())%4==0){
			if(q1.front().first==q2.front().first){
				lswap=1;
				rswap=(q2.size()-q1.size())/2;
			}
			else{
				lswap=1;
				rswap=(q2.size()-q1.size())/2+1;
			}
		}
		if((q2.size()-q1.size())%4==1){
			if(q1.front().first==q2.front().first){
				lswap=0;
				rswap=(q2.size()-q1.size())/2+1;
			}
			else{
				lswap=1;
				rswap=(q2.size()-q1.size())/2+1;
			}
		} 
		if((q2.size()-q1.size())%4==2){
			//cout<<"?\n";
			lswap=1;//s
			rswap=(q2.size()-q1.size())/4*2+2;
		} 
		if((q2.size()-q1.size())%4==3){
			if(q1.front().first==q2.front().first||q1.size()==1){
				lswap=1;
				rswap=(q2.size()-q1.size())/4*2+2;
			}
			else{
				lswap=1;
				rswap=(q2.size()-q1.size())/4*2+3;
			}
		} 
	//}
	int ansa=0,ansb=0;
	while(lswap--){
		tmp_a[++tmp_lena]=q1.front();
		ansa+=tmp_a[tmp_lena].second;
		q1.pop_front();
	}
	while(rswap--){
		tmp_b[++tmp_lenb]=q2.front();
		ansb+=tmp_b[tmp_lenb].second;
		q2.pop_front();
	}
	output[++outlen]=(Out){rev,ansa,ansb};
	if(tmp_lena&&!q2.empty()){
		pair<int,int>pp2=q2.front();
		if(tmp_a[tmp_lena].first==pp2.first){
			q2.pop_front();
			q2.push_front(make_pair(pp2.first,pp2.second+tmp_a[tmp_lena].second));
			tmp_lena--;
		}
	}
	if(tmp_lenb&&!q1.empty()){
		pair<int,int>pp1=q1.front();
		if(tmp_b[tmp_lenb].first==pp1.first){
			q1.pop_front();
			q1.push_front(make_pair(pp1.first,pp1.second+tmp_b[tmp_lenb].second));
			tmp_lenb--;
		}
	}
	//cout<<tmp_lena<<" "<<tmp_lenb<<"\n";
	//cout<<q1.size()<<" "<<q2.size()<<"\n";
	for(int i=tmp_lena;i>=1;i--){
		q2.push_front(tmp_a[i]);
	}
	for(int i=tmp_lenb;i>=1;i--){
		q1.push_front(tmp_b[i]);
	}
	if(q1.size()>q2.size()){
		swap(q1,q2);
		rev^=1;
	}
	//cout<<q1.size()<<" "<<q2.size()<<" sfd\n";
	work(q1.size(),q2.size());
	cout<<outlen<<"\n";
	for(int i=1;i<=outlen;i++){
		if(!output[i].op)cout<<output[i].l<<" "<<output[i].r<<"\n";
		else cout<<output[i].r<<" "<<output[i].l<<"\n";
	}
	return 0;
} 

详细

Subtask #1:

score: 5
Accepted

Test #1:

score: 5
Accepted
time: 1ms
memory: 5852kb

input:

a
b

output:

0

result:

ok Operations: 0

Test #2:

score: 5
Accepted
time: 1ms
memory: 5568kb

input:

b
a

output:

0

result:

ok Operations: 0

Test #3:

score: 5
Accepted
time: 1ms
memory: 5652kb

input:

a
bb

output:

0

result:

ok Operations: 0

Test #4:

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

input:

b
ab

output:

1
1 1

result:

ok Operations: 1

Test #5:

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

input:

b
ba

output:

1
0 1

result:

ok Operations: 1

Test #6:

score: 5
Accepted
time: 1ms
memory: 7684kb

input:

ab
bb

output:

1
1 2

result:

ok Operations: 1

Test #7:

score: 5
Accepted
time: 1ms
memory: 5632kb

input:

ba
bb

output:

1
1 0

result:

ok Operations: 1

Test #8:

score: 5
Accepted
time: 1ms
memory: 7916kb

input:

bab
bbb

output:

2
2 3
0 1

result:

ok Operations: 2

Test #9:

score: 5
Accepted
time: 1ms
memory: 7704kb

input:

abb
bbb

output:

1
1 3

result:

ok Operations: 1

Test #10:

score: 5
Accepted
time: 1ms
memory: 5520kb

input:

a
bbbb

output:

0

result:

ok Operations: 0

Test #11:

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

input:

abbb
b

output:

1
1 1

result:

ok Operations: 1

Test #12:

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

input:

b
bbba

output:

1
0 3

result:

ok Operations: 1

Test #13:

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

input:

bbb
abbbb

output:

1
3 1

result:

ok Operations: 1

Test #14:

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

input:

bbbbba
bbbb

output:

1
5 0

result:

ok Operations: 1

Test #15:

score: 5
Accepted
time: 1ms
memory: 7840kb

input:

abbbbb
bbbbbb

output:

1
1 6

result:

ok Operations: 1

Test #16:

score: 5
Accepted
time: 1ms
memory: 5652kb

input:

bbbbba
bbbbbb

output:

1
5 0

result:

ok Operations: 1

Test #17:

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

input:

bbbbbb
bbbbba

output:

1
0 5

result:

ok Operations: 1

Test #18:

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

input:

bbabbb
bbbbbb

output:

2
3 6
0 2

result:

ok Operations: 2

Test #19:

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

input:

bbbbbb
bbbabb

output:

2
6 4
3 0

result:

ok Operations: 2

Subtask #2:

score: 10
Accepted

Dependency #1:

100%
Accepted

Test #20:

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

input:

aaaaaa
bbbbbb

output:

0

result:

ok Operations: 0

Test #21:

score: 10
Accepted
time: 1ms
memory: 5632kb

input:

aaaaaa
aaaabb

output:

1
0 4

result:

ok Operations: 1

Test #22:

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

input:

aaaaba
aaaaaa

output:

2
5 6
0 4

result:

ok Operations: 2

Test #23:

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

input:

bbabba
bbbbbb

output:

3
3 6
0 2
10 1

result:

ok Operations: 3

Test #24:

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

input:

bbabab
bbbbbb

output:

3
3 6
7 0
1 9

result:

ok Operations: 3

Test #25:

score: 10
Accepted
time: 1ms
memory: 5868kb

input:

bbbbbb
bababa

output:

3
0 3
1 1
2 2

result:

ok Operations: 3

Test #26:

score: 10
Accepted
time: 1ms
memory: 7844kb

input:

bbbbba
bbbba

output:

2
5 0
1 9

result:

ok Operations: 2

Test #27:

score: 10
Accepted
time: 1ms
memory: 5664kb

input:

aaaaba
aaabbb

output:

2
4 0
1 7

result:

ok Operations: 2

Test #28:

score: 10
Accepted
time: 1ms
memory: 7680kb

input:

bbbbba
baaaba

output:

3
5 4
1 0
4 7

result:

ok Operations: 3

Test #29:

score: 10
Accepted
time: 1ms
memory: 7872kb

input:

baabab
bbbbaa

output:

3
3 4
5 0
1 6

result:

ok Operations: 3

Test #30:

score: 10
Accepted
time: 1ms
memory: 7640kb

input:

bababa
bbbaaa

output:

4
2 3
4 0
1 5
6 5

result:

ok Operations: 4

Test #31:

score: 10
Accepted
time: 1ms
memory: 7872kb

input:

abbbba
aaaaba

output:

3
1 0
4 5
6 5

result:

ok Operations: 3

Test #32:

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

input:

abbaa
abbabb

output:

3
0 1
2 2
4 3

result:

ok Operations: 3

Test #33:

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

input:

baabab
bbbabb

output:

4
3 3
0 1
5 3
4 7

result:

ok Operations: 4

Test #34:

score: 10
Accepted
time: 1ms
memory: 7572kb

input:

bababa
bbbabb

output:

4
2 3
4 0
1 5
6 3

result:

ok Operations: 4

Test #35:

score: 10
Accepted
time: 1ms
memory: 7908kb

input:

baabaa
baabaa

output:

4
1 0
2 2
3 4
6 4

result:

ok Operations: 4

Test #36:

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

input:

bbbaba
bababb

output:

4
0 1
4 1
2 5
6 3

result:

ok Operations: 4

Test #37:

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

input:

bababa
bbabaa

output:

5
2 2
0 1
4 2
3 5
6 5

result:

ok Operations: 5

Test #38:

score: 10
Accepted
time: 1ms
memory: 7616kb

input:

babaab
bbabab

output:

5
1 0
1 3
4 2
4 5
6 5

result:

ok Operations: 5

Test #39:

score: 10
Accepted
time: 1ms
memory: 5856kb

input:

bbabab
bababa

output:

5
0 1
3 1
2 4
5 3
4 6

result:

ok Operations: 5

Test #40:

score: 10
Accepted
time: 1ms
memory: 7572kb

input:

bababa
bababa

output:

6
1 0
1 2
3 2
3 4
5 4
5 6

result:

ok Operations: 6

Test #41:

score: 10
Accepted
time: 1ms
memory: 7872kb

input:

bbbbba
aaaaaa

output:

1
5 6

result:

ok Operations: 1

Test #42:

score: 10
Accepted
time: 1ms
memory: 7904kb

input:

aabaaa
bbbbbb

output:

2
3 6
6 2

result:

ok Operations: 2

Test #43:

score: 10
Accepted
time: 1ms
memory: 7904kb

input:

bbabba
aaaaaa

output:

3
3 6
6 2
4 7

result:

ok Operations: 3

Test #44:

score: 10
Accepted
time: 1ms
memory: 7680kb

input:

abbaba
bbbbbb

output:

3
4 6
7 1
2 9

result:

ok Operations: 3

Test #45:

score: 10
Accepted
time: 1ms
memory: 7676kb

input:

bbbbbb
ababab

output:

3
6 3
1 7
8 2

result:

ok Operations: 3

Test #46:

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

input:

bbbaa
aaaabb

output:

1
3 4

result:

ok Operations: 1

Test #47:

score: 10
Accepted
time: 1ms
memory: 7700kb

input:

bbbbba
aabaaa

output:

2
5 2
3 6

result:

ok Operations: 2

Test #48:

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

input:

bbaaaa
aababb

output:

3
2 3
2 2
3 3

result:

ok Operations: 3

Test #49:

score: 10
Accepted
time: 1ms
memory: 7680kb

input:

bbbbaa
abbaba

output:

3
4 4
1 5
7 2

result:

ok Operations: 3

Test #50:

score: 10
Accepted
time: 1ms
memory: 7876kb

input:

bababa
aaaabb

output:

3
3 4
5 1
2 6

result:

ok Operations: 3

Test #51:

score: 10
Accepted
time: 1ms
memory: 7620kb

input:

bbaaab
abaaaa

output:

2
2 1
4 3

result:

ok Operations: 2

Test #52:

score: 10
Accepted
time: 1ms
memory: 7616kb

input:

baabaa
aabba

output:

3
1 2
4 3
4 5

result:

ok Operations: 3

Test #53:

score: 10
Accepted
time: 1ms
memory: 7640kb

input:

babbab
abbbaa

output:

4
2 1
1 1
3 2
3 6

result:

ok Operations: 4

Test #54:

score: 10
Accepted
time: 1ms
memory: 7916kb

input:

aaabba
bababa

output:

4
3 3
1 4
5 2
5 6

result:

ok Operations: 4

Test #55:

score: 10
Accepted
time: 1ms
memory: 7636kb

input:

aabbab
baaaba

output:

3
2 1
3 5
6 4

result:

ok Operations: 3

Test #56:

score: 10
Accepted
time: 1ms
memory: 7696kb

input:

baabab
aabbab

output:

4
1 2
4 3
4 5
6 5

result:

ok Operations: 4

Test #57:

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

input:

bbabba
ababab

output:

5
2 2
1 2
3 2
3 4
6 4

result:

ok Operations: 5

Test #58:

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

input:

aababa
baabab

output:

4
2 1
2 4
5 3
4 6

result:

ok Operations: 4

Test #59:

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

input:

babaab
ababab

output:

5
1 1
2 2
3 3
5 4
5 6

result:

ok Operations: 5

Test #60:

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

input:

ababab
bababa

output:

5
1 1
2 2
3 3
4 4
5 5

result:

ok Operations: 5

Subtask #3:

score: 20
Accepted

Dependency #1:

100%
Accepted

Dependency #2:

100%
Accepted

Test #61:

score: 20
Accepted
time: 1ms
memory: 5792kb

input:

bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa

output:

0

result:

ok Operations: 0

Test #62:

score: 20
Accepted
time: 1ms
memory: 5796kb

input:

bababababababababababababababababababababababababa
bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb

output:

25
25 0
1 1
2 2
3 3
4 4
5 5
6 6
7 7
8 8
9 9
10 10
11 11
12 12
13 13
14 14
15 15
16 16
17 17
18 18
19 19
20 20
21 21
22 22
23 23
24 24

result:

ok Operations: 25

Test #63:

score: 20
Accepted
time: 1ms
memory: 7688kb

input:

aaaaaaaaaaaaaaaaaaabbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb
ababababababababababababababababababababababababab

output:

26
19 24
0 20
21 1
2 22
23 3
4 24
25 5
6 26
27 7
8 28
29 9
10 30
31 11
12 32
33 13
14 34
35 15
16 36
37 17
18 38
39 19
20 40
41 21
22 42
43 23
55 44

result:

ok Operations: 26

Test #64:

score: 20
Accepted
time: 1ms
memory: 7612kb

input:

bbbbbbbbbbbbbbbbbbbbbbbbbbbbaabbbbbbbbbbbbbbbbbbbb
bababababababababababababababababababababababababa

output:

26
28 24
0 29
30 1
2 31
32 3
4 33
34 5
6 35
36 7
8 37
38 9
10 39
40 11
12 41
42 13
14 43
44 15
16 45
46 17
18 47
48 19
20 49
50 21
22 51
52 23
26 53

result:

ok Operations: 26

Test #65:

score: 20
Accepted
time: 1ms
memory: 7680kb

input:

bababababababababababababababababababababababababa
bbbbbbbbbbbbbbbbbbbaaaaaaaaabbbbbbbbbbbbbbbbbbbbaa

output:

27
24 19
0 1
21 1
2 22
23 3
4 24
25 5
6 26
27 7
8 28
29 9
10 30
31 11
12 32
33 13
14 34
35 15
16 36
37 17
18 38
39 19
20 40
41 21
22 42
43 32
33 63
64 35

result:

ok Operations: 27

Test #66:

score: 20
Accepted
time: 1ms
memory: 7876kb

input:

ababababababababababababababababababababababababa
aabbbabbbbabbbaabbbabbaabaaaaabaaabaabaababbaaba

output:

37
12 2
3 0
1 4
5 2
3 6
7 4
5 8
9 6
7 10
11 8
9 12
13 10
11 14
15 15
16 16
17 20
21 18
19 24
25 21
22 28
29 23
24 31
32 26
27 33
34 32
33 35
36 36
37 37
38 39
40 39
40 42
43 41
42 44
45 44
45 47
48 46
47 49

result:

ok Operations: 37

Test #67:

score: 20
Accepted
time: 1ms
memory: 7700kb

input:

bababababababababababababababababababababababababa
bababababababababababababababababababababababababa

output:

50
1 0
1 2
3 2
3 4
5 4
5 6
7 6
7 8
9 8
9 10
11 10
11 12
13 12
13 14
15 14
15 16
17 16
17 18
19 18
19 20
21 20
21 22
23 22
23 24
25 24
25 26
27 26
27 28
29 28
29 30
31 30
31 32
33 32
33 34
35 34
35 36
37 36
37 38
39 38
39 40
41 40
41 42
43 42
43 44
45 44
45 46
47 46
47 48
49 48
49 50

result:

ok Operations: 50

Test #68:

score: 20
Accepted
time: 1ms
memory: 5572kb

input:

ababababababababababababababababababababababababab
ababababababababababababababababababababababaababa

output:

49
1 0
1 2
3 2
3 4
5 4
5 6
7 6
7 8
9 8
9 10
11 10
11 12
13 12
13 14
15 14
15 16
17 16
17 18
19 18
19 20
21 20
21 22
23 22
23 24
25 24
25 26
27 26
27 28
29 28
29 30
31 30
31 32
33 32
33 34
35 34
35 36
37 36
37 38
39 38
39 40
41 40
41 42
43 42
43 44
45 44
45 47
48 46
47 49
50 48

result:

ok Operations: 49

Test #69:

score: 20
Accepted
time: 1ms
memory: 7612kb

input:

ababababababababababababababbababababababababababa
abababababababababababababababababaabababababababa

output:

49
1 0
1 2
3 2
3 4
5 4
5 6
7 6
7 8
9 8
9 10
11 10
11 12
13 12
13 14
15 14
15 16
17 16
17 18
19 18
19 20
21 20
21 22
23 22
23 24
25 24
25 26
27 26
28 28
29 29
30 30
31 31
32 32
33 33
34 34
35 35
36 37
38 37
38 39
40 39
40 41
42 41
42 43
44 43
44 45
46 45
46 47
48 47
48 49
50 49

result:

ok Operations: 49

Test #70:

score: 20
Accepted
time: 1ms
memory: 7692kb

input:

abababababababababababababaabababababababbabababab
ababababababababababababababababababababababababab

output:

49
1 2
1 0
2 3
4 3
4 5
6 5
6 7
8 7
8 9
10 9
10 11
12 11
12 13
14 13
14 15
16 15
16 17
18 17
18 19
20 19
20 21
22 21
22 23
24 23
24 25
26 25
26 27
29 27
28 30
31 29
30 32
33 31
32 34
35 33
34 36
37 35
36 38
39 37
38 40
41 39
41 42
43 42
43 44
45 44
45 46
47 46
47 48
49 48
49 50

result:

ok Operations: 49

Test #71:

score: 20
Accepted
time: 1ms
memory: 7620kb

input:

bababababababababababababababababababababababababa
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa

output:

25
25 49
50 1
2 51
52 3
4 53
54 5
6 55
56 7
8 57
58 9
10 59
60 11
12 61
62 13
14 63
64 15
16 65
66 17
18 67
68 19
20 69
70 21
22 71
72 23
24 73

result:

ok Operations: 25

Test #72:

score: 20
Accepted
time: 1ms
memory: 7708kb

input:

bababababababababababababababababababababababababa
aaaaaaaaaaaaaabbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb

output:

25
25 14
15 1
2 16
17 3
4 18
19 5
6 20
21 7
8 22
23 9
10 24
25 11
12 26
27 13
14 28
29 15
16 30
31 17
18 32
33 19
20 34
35 21
22 36
37 23
24 38

result:

ok Operations: 25

Test #73:

score: 20
Accepted
time: 1ms
memory: 7872kb

input:

bbbbbbbbbbbbbbaaaaaaaaaaaaaaaaaaaaabbbbbbbbbbbbbbb
ababababababababababababababababababababababababab

output:

26
14 25
1 15
16 2
3 17
18 4
5 19
20 6
7 21
22 8
9 23
24 10
11 25
26 12
13 27
28 14
15 29
30 16
17 31
32 18
19 33
34 20
21 35
36 22
23 37
38 24
46 39

result:

ok Operations: 26

Test #74:

score: 20
Accepted
time: 1ms
memory: 7620kb

input:

bababababababababababababababababababababababababa
aaabbbbbbbbbbbbbbbbbbbbbbbbbbbaaaaaaaaaaaaaaabbbbb

output:

27
24 3
3 1
2 4
5 3
4 6
7 5
6 8
9 7
8 10
11 9
10 12
13 11
12 14
15 13
14 16
17 15
16 18
19 17
18 20
21 19
20 22
23 21
22 24
25 23
24 26
27 51
52 42

result:

ok Operations: 27

Test #75:

score: 20
Accepted
time: 1ms
memory: 7640kb

input:

ababababababababababababababababababababababababa
babbaaaabbbbabbaaabbaabbaaababbaaaabaababaabaaab

output:

36
13 1
2 1
2 3
4 3
4 5
6 5
6 7
8 7
8 9
10 9
10 11
12 11
12 13
14 14
15 16
17 19
20 21
22 21
22 24
25 25
26 27
28 28
29 30
31 32
33 32
33 34
35 35
36 39
40 37
38 42
43 39
40 44
45 41
42 47
48 43
44 51

result:

ok Operations: 36

Test #76:

score: 20
Accepted
time: 1ms
memory: 7684kb

input:

ababababababababababababababababababababababababab
bababababababababababababababababababababababababa

output:

49
1 1
2 2
3 3
4 4
5 5
6 6
7 7
8 8
9 9
10 10
11 11
12 12
13 13
14 14
15 15
16 16
17 17
18 18
19 19
20 20
21 21
22 22
23 23
24 24
25 25
26 26
27 27
28 28
29 29
30 30
31 31
32 32
33 33
34 34
35 35
36 36
37 37
38 38
39 39
40 40
41 41
42 42
43 43
44 44
45 45
46 46
47 47
48 48
49 49

result:

ok Operations: 49

Test #77:

score: 20
Accepted
time: 1ms
memory: 7680kb

input:

ababababababababababababababababababababababababab
babababababababaababababababababababababababababab

output:

49
1 1
2 2
3 3
4 4
5 5
6 6
7 7
8 8
9 9
10 10
11 11
12 12
13 13
14 14
15 15
16 17
18 17
18 19
20 19
20 21
22 21
22 23
24 23
24 25
26 25
26 27
28 27
28 29
30 29
30 31
32 31
32 33
34 33
34 35
36 35
36 37
38 37
38 39
40 39
40 41
42 41
42 43
44 43
44 45
46 45
46 47
48 47
48 49
50 49

result:

ok Operations: 49

Test #78:

score: 20
Accepted
time: 1ms
memory: 7684kb

input:

bababbabababababababababababababababababababababab
abababababababababababbabababababababababababababa

output:

48
1 1
2 2
3 3
4 4
6 5
6 7
8 7
8 9
10 9
10 11
12 11
12 13
14 13
14 15
16 15
16 17
18 17
18 19
20 19
20 21
22 21
22 24
25 23
24 26
27 25
26 28
29 27
28 30
31 29
30 32
33 31
32 34
35 33
34 36
37 35
36 38
39 37
38 40
41 39
40 42
43 41
42 44
45 43
44 46
47 45
46 48
49 47
48 50

result:

ok Operations: 48

Test #79:

score: 20
Accepted
time: 1ms
memory: 7700kb

input:

bababababababababababababababababababababababababa
aabababababababababababababababababababababababaab

output:

49
2 2
2 1
2 3
4 3
4 5
6 5
6 7
8 7
8 9
10 9
10 11
12 11
12 13
14 13
14 15
16 15
16 17
18 17
18 19
20 19
20 21
22 21
22 23
24 23
24 25
26 25
26 27
28 27
28 29
30 29
30 31
32 31
32 33
34 33
34 35
36 35
36 37
38 37
38 39
40 39
40 41
42 41
42 43
44 43
44 45
46 45
46 47
48 47
48 50

result:

ok Operations: 49

Subtask #4:

score: 20
Accepted

Dependency #1:

100%
Accepted

Dependency #2:

100%
Accepted

Dependency #3:

100%
Accepted

Test #80:

score: 20
Accepted
time: 1ms
memory: 5824kb

input:

aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb...

output:

0

result:

ok Operations: 0

Test #81:

score: 20
Accepted
time: 1ms
memory: 5656kb

input:

bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb
babababababababababababababababababababababababab...

output:

125
0 125
1 1
2 2
3 3
4 4
5 5
6 6
7 7
8 8
9 9
10 10
11 11
12 12
13 13
14 14
15 15
16 16
17 17
18 18
19 19
20 20
21 21
22 22
23 23
24 24
25 25
26 26
27 27
28 28
29 29
30 30
31 31
32 32
33 33
34 34
35 35
36 36
37 37
38 38
39 39
40 40
41 41
42 42
43 43
44 44
45 45
46 46
47 47
48 48
49 49
50 50
51 51
52...

result:

ok Operations: 125

Test #82:

score: 20
Accepted
time: 1ms
memory: 7908kb

input:

aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaabbb
ababababababababababababababababababababababababa...

output:

126
247 124
0 248
249 1
2 250
251 3
4 252
253 5
6 254
255 7
8 256
257 9
10 258
259 11
12 260
261 13
14 262
263 15
16 264
265 17
18 266
267 19
20 268
269 21
22 270
271 23
24 272
273 25
26 274
275 27
28 276
277 29
30 278
279 31
32 280
281 33
34 282
283 35
36 284
285 37
38 286
287 39
40 288
289 41
42 2...

result:

ok Operations: 126

Test #83:

score: 20
Accepted
time: 1ms
memory: 7688kb

input:

ababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababab
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa...

output:

126
124 146
147 0
1 148
149 2
3 150
151 4
5 152
153 6
7 154
155 8
9 156
157 10
11 158
159 12
13 160
161 14
15 162
163 16
17 164
165 18
19 166
167 20
21 168
169 22
23 170
171 24
25 172
173 26
27 174
175 28
29 176
177 30
31 178
179 32
33 180
181 34
35 182
183 36
37 184
185 38
39 186
187 40
41 188
189 ...

result:

ok Operations: 126

Test #84:

score: 20
Accepted
time: 1ms
memory: 7676kb

input:

bababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababa
bbbbbbbbbbaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa...

output:

127
124 10
0 1
12 1
2 13
14 3
4 15
16 5
6 17
18 7
8 19
20 9
10 21
22 11
12 23
24 13
14 25
26 15
16 27
28 17
18 29
30 19
20 31
32 21
22 33
34 23
24 35
36 25
26 37
38 27
28 39
40 29
30 41
42 31
32 43
44 33
34 45
46 35
36 47
48 37
38 49
50 39
40 51
52 41
42 53
54 43
44 55
56 45
46 57
58 47
48 59
60 49
...

result:

ok Operations: 127

Test #85:

score: 20
Accepted
time: 1ms
memory: 7916kb

input:

ababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababab
ababababababababababababababababababababababababa...

output:

250
1 0
1 2
3 2
3 4
5 4
5 6
7 6
7 8
9 8
9 10
11 10
11 12
13 12
13 14
15 14
15 16
17 16
17 18
19 18
19 20
21 20
21 22
23 22
23 24
25 24
25 26
27 26
27 28
29 28
29 30
31 30
31 32
33 32
33 34
35 34
35 36
37 36
37 38
39 38
39 40
41 40
41 42
43 42
43 44
45 44
45 46
47 46
47 48
49 48
49 50
51 50
51 52
53 ...

result:

ok Operations: 250

Test #86:

score: 20
Accepted
time: 1ms
memory: 5836kb

input:

ababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababab
ababababababababababababababababababaabababababab...

output:

249
1 0
1 2
3 2
3 4
5 4
5 6
7 6
7 8
9 8
9 10
11 10
11 12
13 12
13 14
15 14
15 16
17 16
17 18
19 18
19 20
21 20
21 22
23 22
23 24
25 24
25 26
27 26
27 28
29 28
29 30
31 30
31 32
33 32
33 34
35 34
35 36
37 36
37 39
40 38
39 41
42 40
41 43
44 42
43 45
46 44
45 47
48 46
47 49
50 48
49 51
52 50
51 53
54 ...

result:

ok Operations: 249

Test #87:

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

input:

abababababababababababababababababababababababababababababababababababababababababaabababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababa
ababababababababababababababababababababababababa...

output:

249
1 0
1 2
3 2
3 4
5 4
5 6
7 6
7 8
9 8
9 10
11 10
11 12
13 12
13 14
15 14
15 16
17 16
17 18
19 18
19 20
21 20
21 22
23 22
23 24
25 24
25 26
27 26
27 28
29 28
29 30
31 30
31 32
33 32
33 34
35 34
35 36
37 36
37 38
39 38
39 40
41 40
41 42
43 42
43 44
45 44
45 46
47 46
47 48
49 48
49 50
51 50
51 52
53 ...

result:

ok Operations: 249

Test #88:

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

input:

bababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababaabababababababababababababababababababababababababa
bababaabaaaaabababbaababbbbbbabbabbabbbbbabbaaabba...

output:

199
50 1
0 1
3 1
2 4
5 3
4 6
7 5
6 8
9 7
8 10
11 9
10 12
13 11
12 14
15 13
14 16
17 15
16 18
19 17
18 20
21 19
20 22
23 21
22 24
25 23
24 26
27 25
26 28
29 27
28 30
31 29
30 32
33 31
32 34
35 33
34 36
37 35
36 38
39 37
38 40
41 39
40 42
43 41
42 44
45 43
44 46
47 45
46 48
49 47
48 50
51 50
51 52
53 ...

result:

ok Operations: 199

Test #89:

score: 20
Accepted
time: 1ms
memory: 7916kb

input:

abababababaabbaaabababababababbbaaababaaabbaababaababaabababaabaababbabababaababaabababababaabbabaabaabbabababbabbaaabaabababababababaababbaabaababbbabababaaabaabaabbababababbabaabaababbabbaababababaabbababaaabbaababaabaababababababbaabaabababbababba
aaaaaaaaaaaabbbaaabaaaaabbbbbbbbbbbaaaaaaaaaaabbb...

output:

111
104 12
13 0
1 14
15 2
3 16
17 4
6 18
19 7
9 20
23 10
11 24
26 12
13 28
29 15
16 32
33 17
18 34
35 19
20 36
37 21
22 38
39 23
24 40
41 25
26 42
44 27
28 45
46 31
33 49
51 34
35 52
54 36
37 57
58 39
42 60
61 43
44 62
63 45
46 65
66 47
48 67
70 49
50 72
74 51
52 75
77 53
55 78
79 56
57 81
82 58
59 ...

result:

ok Operations: 111

Test #90:

score: 20
Accepted
time: 1ms
memory: 7552kb

input:

ababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababab
bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb...

output:

125
125 250
251 1
2 252
253 3
4 254
255 5
6 256
257 7
8 258
259 9
10 260
261 11
12 262
263 13
14 264
265 15
16 266
267 17
18 268
269 19
20 270
271 21
22 272
273 23
24 274
275 25
26 276
277 27
28 278
279 29
30 280
281 31
32 282
283 33
34 284
285 35
36 286
287 37
38 288
289 39
40 290
291 41
42 292
293...

result:

ok Operations: 125

Test #91:

score: 20
Accepted
time: 1ms
memory: 7684kb

input:

aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaabbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb
babababababababababababababababababababababababab...

output:

125
205 125
1 206
207 2
3 208
209 4
5 210
211 6
7 212
213 8
9 214
215 10
11 216
217 12
13 218
219 14
15 220
221 16
17 222
223 18
19 224
225 20
21 226
227 22
23 228
229 24
25 230
231 26
27 232
233 28
29 234
235 30
31 236
237 32
33 238
239 34
35 240
241 36
37 242
243 38
39 244
245 40
41 246
247 42
43 ...

result:

ok Operations: 125

Test #92:

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

input:

aaaaabbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
babababababababababababababababababababababababab...

output:

126
5 125
1 6
7 2
3 8
9 4
5 10
11 6
7 12
13 8
9 14
15 10
11 16
17 12
13 18
19 14
15 20
21 16
17 22
23 18
19 24
25 20
21 26
27 22
23 28
29 24
25 30
31 26
27 32
33 28
29 34
35 30
31 36
37 32
33 38
39 34
35 40
41 36
37 42
43 38
39 44
45 40
41 46
47 42
43 48
49 44
45 50
51 46
47 52
53 48
49 54
55 50
51 ...

result:

ok Operations: 126

Test #93:

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

input:

bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaabbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
ababababababababababababababababababababababababa...

output:

127
124 124
1 124
125 2
3 126
127 4
5 128
129 6
7 130
131 8
9 132
133 10
11 134
135 12
13 136
137 14
15 138
139 16
17 140
141 18
19 142
143 20
21 144
145 22
23 146
147 24
25 148
149 26
27 150
151 28
29 152
153 30
31 154
155 32
33 156
157 34
35 158
159 36
37 160
161 38
39 162
163 40
41 164
165 42
43 ...

result:

ok Operations: 127

Test #94:

score: 20
Accepted
time: 1ms
memory: 7588kb

input:

bababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababa
ababababababababababababababababababababababababa...

output:

249
1 1
2 2
3 3
4 4
5 5
6 6
7 7
8 8
9 9
10 10
11 11
12 12
13 13
14 14
15 15
16 16
17 17
18 18
19 19
20 20
21 21
22 22
23 23
24 24
25 25
26 26
27 27
28 28
29 29
30 30
31 31
32 32
33 33
34 34
35 35
36 36
37 37
38 38
39 39
40 40
41 41
42 42
43 43
44 44
45 45
46 46
47 47
48 48
49 49
50 50
51 51
52 52
53...

result:

ok Operations: 249

Test #95:

score: 20
Accepted
time: 1ms
memory: 7916kb

input:

ababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababab
babababababababababababababababababababababababab...

output:

249
1 1
2 2
3 3
4 4
5 5
6 6
7 7
8 8
9 9
10 10
11 11
12 12
13 13
14 14
15 15
16 16
17 17
18 18
19 19
20 20
21 21
22 22
23 23
24 24
25 25
26 26
27 27
28 28
29 29
30 30
31 31
32 32
33 33
34 34
35 35
36 36
37 37
38 38
39 39
40 40
41 41
42 42
43 43
44 44
45 45
46 46
47 47
48 48
49 49
50 50
51 51
52 52
53...

result:

ok Operations: 249

Test #96:

score: 20
Accepted
time: 1ms
memory: 7696kb

input:

bababababababababababababababababababababababababababababababababaabababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababab
ababababababababababbabababababababababababababab...

output:

248
1 1
2 2
3 3
4 4
5 5
6 6
7 7
8 8
9 9
10 10
11 11
12 12
13 13
14 14
15 15
16 16
17 17
18 18
19 19
20 21
22 21
22 23
24 23
24 25
26 25
26 27
28 27
28 29
30 29
30 31
32 31
32 33
34 33
34 35
36 35
36 37
38 37
38 39
40 39
40 41
42 41
42 43
44 43
44 45
46 45
46 47
48 47
48 49
50 49
50 51
52 51
52 53
54...

result:

ok Operations: 248

Test #97:

score: 20
Accepted
time: 1ms
memory: 7692kb

input:

ababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababbabababababababab
bababbaababbbababababaabaabbbbabbaaaababbbababaaab...

output:

199
50 1
1 1
2 2
3 3
4 4
5 5
6 6
7 7
8 8
9 9
10 10
11 11
12 12
13 13
14 14
15 15
16 16
17 17
18 18
19 19
20 20
21 21
22 22
23 23
24 24
25 25
26 26
27 27
28 28
29 29
30 30
31 31
32 32
33 33
34 34
35 35
36 36
37 37
38 38
39 39
40 40
41 41
42 42
43 43
44 44
45 45
46 46
47 47
48 48
49 49
50 50
51 51
52 ...

result:

ok Operations: 199

Test #98:

score: 20
Accepted
time: 1ms
memory: 7636kb

input:

aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaabbbbbbbbbbaaaaaaaaabbbbbaabbbbbbbbbbbaaaabbbaaaabbbbbbbbabbbaaaaaaaaaabbbbbaaaaaaaaaaaabbbbbbbbbaaabbbbbbbbbbbbbbbaaaaaaaaaaaaaaaabaaaaaaaaaaabbbbbbbbbbbbbbbbbaaaaaabbbbbbbbaaaaabbbbbbbbbbbbaaaaaaaabbbbbbbbbbbbbaaabaaa
baababababaabababbabababababbababababababababaaaba...

output:

110
31 103
1 32
34 2
3 36
37 4
5 38
39 7
8 41
42 9
10 43
45 11
12 46
47 14
15 48
49 17
19 50
51 20
21 52
53 22
23 54
55 24
25 57
58 28
29 59
60 30
32 64
65 33
34 66
67 35
36 69
70 37
38 71
72 39
40 73
74 44
45 75
76 46
47 77
78 49
50 80
81 52
53 82
85 56
57 86
87 58
59 89
90 61
62 91
93 63
64 94
95 ...

result:

ok Operations: 110

Subtask #5:

score: 20
Accepted

Dependency #1:

100%
Accepted

Dependency #2:

100%
Accepted

Dependency #3:

100%
Accepted

Dependency #4:

100%
Accepted

Test #99:

score: 20
Accepted
time: 1ms
memory: 5664kb

input:

aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa...

output:

0

result:

ok Operations: 0

Test #100:

score: 20
Accepted
time: 1ms
memory: 7704kb

input:

bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb...

output:

1001
2000 1000
1 0
1 2002
2003 2
3 2004
2005 4
5 2006
2007 6
7 2008
2009 8
9 2010
2011 10
11 2012
2013 12
13 2014
2015 14
15 2016
2017 16
17 2018
2019 18
19 2020
2021 20
21 2022
2023 22
23 2024
2025 24
25 2026
2027 26
27 2028
2029 28
29 2030
2031 30
31 2032
2033 32
33 2034
2035 34
35 2036
2037 36
37...

result:

ok Operations: 1001

Test #101:

score: 20
Accepted
time: 1ms
memory: 7704kb

input:

abababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababab...

output:

1001
1000 1927
0 1
1929 1
2 1930
1931 3
4 1932
1933 5
6 1934
1935 7
8 1936
1937 9
10 1938
1939 11
12 1940
1941 13
14 1942
1943 15
16 1944
1945 17
18 1946
1947 19
20 1948
1949 21
22 1950
1951 23
24 1952
1953 25
26 1954
1955 27
28 1956
1957 29
30 1958
1959 31
32 1960
1961 33
34 1962
1963 35
36 1964
19...

result:

ok Operations: 1001

Test #102:

score: 20
Accepted
time: 1ms
memory: 5696kb

input:

aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaabbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb...

output:

1001
0 999
1 1
2 2
3 3
4 4
5 5
6 6
7 7
8 8
9 9
10 10
11 11
12 12
13 13
14 14
15 15
16 16
17 17
18 18
19 19
20 20
21 21
22 22
23 23
24 24
25 25
26 26
27 27
28 28
29 29
30 30
31 31
32 32
33 33
34 34
35 35
36 36
37 37
38 38
39 39
40 40
41 41
42 42
43 43
44 44
45 45
46 46
47 47
48 48
49 49
50 50
51 51
5...

result:

ok Operations: 1001

Test #103:

score: 20
Accepted
time: 2ms
memory: 9812kb

input:

bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa...

output:

1002
222 998
0 223
224 1
2 225
226 3
4 227
228 5
6 229
230 7
8 231
232 9
10 233
234 11
12 235
236 13
14 237
238 15
16 239
240 17
18 241
242 19
20 243
244 21
22 245
246 23
24 247
248 25
26 249
250 27
28 251
252 29
30 253
254 31
32 255
256 33
34 257
258 35
36 259
260 37
38 261
262 39
40 263
264 41
42 ...

result:

ok Operations: 1002

Test #104:

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

input:

abababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababab...

output:

2000
1 0
1 2
3 2
3 4
5 4
5 6
7 6
7 8
9 8
9 10
11 10
11 12
13 12
13 14
15 14
15 16
17 16
17 18
19 18
19 20
21 20
21 22
23 22
23 24
25 24
25 26
27 26
27 28
29 28
29 30
31 30
31 32
33 32
33 34
35 34
35 36
37 36
37 38
39 38
39 40
41 40
41 42
43 42
43 44
45 44
45 46
47 46
47 48
49 48
49 50
51 50
51 52
53...

result:

ok Operations: 2000

Test #105:

score: 20
Accepted
time: 1ms
memory: 5776kb

input:

babababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababa...

output:

1999
1 0
1 2
3 2
3 4
5 4
5 6
7 6
7 8
9 8
9 10
11 10
11 12
13 12
13 14
15 14
15 16
17 16
17 18
19 18
19 20
21 20
21 22
23 22
23 24
25 24
25 26
27 26
27 28
29 28
29 30
31 30
31 32
33 32
33 34
35 34
35 36
37 36
37 38
39 38
39 40
41 40
41 42
43 42
43 44
45 44
45 46
47 46
47 48
49 48
49 50
51 50
51 52
53...

result:

ok Operations: 1999

Test #106:

score: 20
Accepted
time: 1ms
memory: 7752kb

input:

babababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababa...

output:

1999
1 0
1 2
3 2
3 4
5 4
5 6
7 6
7 8
9 8
9 10
11 10
11 12
13 12
13 14
15 14
15 16
17 16
17 18
19 18
19 20
21 20
21 22
23 22
23 24
25 24
25 26
27 26
27 28
29 28
29 30
31 30
31 32
33 32
33 34
35 34
35 36
37 36
37 38
39 38
39 40
41 40
41 42
43 42
43 44
45 44
45 46
47 46
47 48
49 48
49 50
51 50
51 52
53...

result:

ok Operations: 1999

Test #107:

score: 20
Accepted
time: 1ms
memory: 5980kb

input:

abababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababab...

output:

1998
0 1
2 1
2 3
4 3
4 5
6 5
6 7
8 7
8 9
10 9
10 11
12 11
12 13
14 13
14 15
16 15
16 17
18 17
18 19
20 19
20 21
22 21
22 23
24 23
24 25
26 25
26 27
28 27
28 29
30 29
30 31
32 31
32 33
34 33
34 35
36 35
36 37
38 37
38 39
40 39
40 41
42 41
42 43
44 43
44 45
46 45
46 47
48 47
48 49
50 49
50 51
52 51
52...

result:

ok Operations: 1998

Test #108:

score: 20
Accepted
time: 1ms
memory: 5716kb

input:

aaaaaaaaabbbbaaaaaabbbbbbaaaaabbbbbbbbbbbbbbbbbbbbbbaaabbbbaaaabaabbabbaaaabbbaaaaaaaaaabbbbbbaaaabbbbbbbbbbbbbabbbbbbbaaaabbbbbbbaaaaaabbbbbbbbbbbabbbaaababbaaaaaaaaaaaaaaaaabbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbabbbaaaaaabbbbbbbbbbbbaaabbbbbbbbaaaaaaabbaaaaaaaaabbbbbbbaabaaaaaaaaaaaaaaaaabbbbbbbbb...

output:

1114
0 850
2 2
3 3
5 4
5 6
7 6
7 8
9 8
9 10
11 10
11 12
14 12
13 15
16 14
15 17
18 16
17 19
20 18
19 21
22 20
21 23
24 22
23 25
26 24
25 27
28 26
27 29
30 28
29 31
32 30
31 33
34 33
36 35
36 37
38 37
39 39
40 40
41 41
43 42
43 44
45 44
45 46
47 46
47 48
49 48
49 50
51 50
51 52
53 52
53 54
55 54
55 5...

result:

ok Operations: 1114

Test #109:

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

input:

abababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababab...

output:

1001
1000 2000
2000 1
2 2001
2002 3
4 2003
2004 5
6 2005
2006 7
8 2007
2008 9
10 2009
2010 11
12 2011
2012 13
14 2013
2014 15
16 2015
2016 17
18 2017
2018 19
20 2019
2020 21
22 2021
2022 23
24 2023
2024 25
26 2025
2026 27
28 2027
2028 29
30 2029
2030 31
32 2031
2032 33
34 2033
2034 35
36 2035
2036 3...

result:

ok Operations: 1001

Test #110:

score: 20
Accepted
time: 1ms
memory: 7764kb

input:

babababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababa...

output:

1001
1000 1890
1890 1
2 1891
1892 3
4 1893
1894 5
6 1895
1896 7
8 1897
1898 9
10 1899
1900 11
12 1901
1902 13
14 1903
1904 15
16 1905
1906 17
18 1907
1908 19
20 1909
1910 21
22 1911
1912 23
24 1913
1914 25
26 1915
1916 27
28 1917
1918 29
30 1919
1920 31
32 1921
1922 33
34 1923
1924 35
36 1925
1926 3...

result:

ok Operations: 1001

Test #111:

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

input:

babababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababa...

output:

1001
999 300
301 1
2 302
303 3
4 304
305 5
6 306
307 7
8 308
309 9
10 310
311 11
12 312
313 13
14 314
315 15
16 316
317 17
18 318
319 19
20 320
321 21
22 322
323 23
24 324
325 25
26 326
327 27
28 328
329 29
30 330
331 31
32 332
333 33
34 334
335 35
36 336
337 37
38 338
339 39
40 340
341 41
42 342
34...

result:

ok Operations: 1001

Test #112:

score: 20
Accepted
time: 1ms
memory: 7768kb

input:

aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa...

output:

1001
559 999
1 560
561 2
3 562
563 4
5 564
565 6
7 566
567 8
9 568
569 10
11 570
571 12
13 572
573 14
15 574
575 16
17 576
577 18
19 578
579 20
21 580
581 22
23 582
583 24
25 584
585 26
27 586
587 28
29 588
589 30
31 590
591 32
33 592
593 34
35 594
595 36
37 596
597 38
39 598
599 40
41 600
601 42
43...

result:

ok Operations: 1001

Test #113:

score: 20
Accepted
time: 1ms
memory: 7800kb

input:

babababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababa...

output:

1999
1 1
2 2
3 3
4 4
5 5
6 6
7 7
8 8
9 9
10 10
11 11
12 12
13 13
14 14
15 15
16 16
17 17
18 18
19 19
20 20
21 21
22 22
23 23
24 24
25 25
26 26
27 27
28 28
29 29
30 30
31 31
32 32
33 33
34 34
35 35
36 36
37 37
38 38
39 39
40 40
41 41
42 42
43 43
44 44
45 45
46 46
47 47
48 48
49 49
50 50
51 51
52 52
5...

result:

ok Operations: 1999

Test #114:

score: 20
Accepted
time: 1ms
memory: 7824kb

input:

abababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababab...

output:

1999
1 1
2 2
3 3
4 4
5 5
6 6
7 7
8 8
9 9
10 10
11 11
12 12
13 13
14 14
15 15
16 16
17 17
18 18
19 19
20 20
21 21
22 22
23 23
24 24
25 25
26 26
27 27
28 28
29 29
30 30
31 31
32 32
33 33
34 34
35 35
36 36
37 37
38 38
39 39
40 40
41 41
42 42
43 43
44 44
45 45
46 46
47 47
48 48
49 49
50 50
51 51
52 52
5...

result:

ok Operations: 1999

Test #115:

score: 20
Accepted
time: 1ms
memory: 7692kb

input:

babababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababa...

output:

1998
1 1
2 2
3 3
4 4
5 5
6 6
7 7
8 8
9 9
10 10
11 11
12 12
13 13
14 14
15 15
16 16
17 17
18 18
19 19
20 20
21 21
22 22
23 23
24 24
25 25
26 26
27 27
28 28
29 29
30 30
31 31
32 32
33 33
34 34
35 35
36 36
37 37
38 38
39 39
40 40
41 41
42 42
43 43
44 44
45 45
46 46
47 47
48 48
49 49
50 50
51 51
52 52
5...

result:

ok Operations: 1998

Test #116:

score: 20
Accepted
time: 1ms
memory: 7756kb

input:

abababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababab...

output:

1998
1 1
2 2
3 3
4 4
5 5
6 6
7 7
8 8
9 9
10 10
11 11
12 12
13 13
14 14
15 15
16 16
17 17
18 18
19 19
20 20
21 21
22 22
23 23
24 24
25 25
26 26
27 27
28 28
29 29
30 30
31 31
32 32
33 33
34 34
35 35
36 36
37 37
38 38
39 39
40 40
41 41
42 42
43 43
44 44
45 45
46 46
47 47
48 48
49 49
50 50
51 51
52 52
5...

result:

ok Operations: 1998

Test #117:

score: 20
Accepted
time: 1ms
memory: 7768kb

input:

abababababababababababababaababaabababababababababababababababababababaababababababababababababababababababababababababababababababababababaabababababababababababababababababababababababababababbabababababababaababababababababababababababababababababababababaabababbabababababababababababababbabababa...

output:

1114
832 6
7 1
2 8
9 3
4 10
11 5
6 12
13 7
8 14
16 9
10 17
18 11
12 19
20 13
14 21
22 15
16 23
24 17
18 25
26 19
20 27
28 21
22 29
30 23
24 31
32 25
26 33
34 28
29 35
37 30
31 38
39 33
34 40
41 35
36 42
43 37
38 44
45 39
40 46
47 41
42 48
49 43
44 50
51 45
46 52
53 47
48 54
55 49
50 56
57 51
52 58
5...

result:

ok Operations: 1114

Subtask #6:

score: 25
Accepted

Dependency #1:

100%
Accepted

Dependency #2:

100%
Accepted

Dependency #3:

100%
Accepted

Dependency #4:

100%
Accepted

Dependency #5:

100%
Accepted

Test #118:

score: 25
Accepted
time: 2ms
memory: 5880kb

input:

bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb...

output:

0

result:

ok Operations: 0

Test #119:

score: 25
Accepted
time: 16ms
memory: 16972kb

input:

aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa...

output:

100001
200000 100000
1 0
1 200002
200003 2
3 200004
200005 4
5 200006
200007 6
7 200008
200009 8
9 200010
200011 10
11 200012
200013 12
13 200014
200015 14
15 200016
200017 16
17 200018
200019 18
19 200020
200021 20
21 200022
200023 22
23 200024
200025 24
25 200026
200027 26
27 200028
200029 28
29 2...

result:

ok Operations: 100001

Test #120:

score: 25
Accepted
time: 14ms
memory: 16804kb

input:

abababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababab...

output:

100001
100000 103540
0 1
103542 1
2 103543
103544 3
4 103545
103546 5
6 103547
103548 7
8 103549
103550 9
10 103551
103552 11
12 103553
103554 13
14 103555
103556 15
16 103557
103558 17
18 103559
103560 19
20 103561
103562 21
22 103563
103564 23
24 103565
103566 25
26 103567
103568 27
28 103569
1035...

result:

ok Operations: 100001

Test #121:

score: 25
Accepted
time: 16ms
memory: 14376kb

input:

aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa...

output:

100001
0 99999
1 1
2 2
3 3
4 4
5 5
6 6
7 7
8 8
9 9
10 10
11 11
12 12
13 13
14 14
15 15
16 16
17 17
18 18
19 19
20 20
21 21
22 22
23 23
24 24
25 25
26 26
27 27
28 28
29 29
30 30
31 31
32 32
33 33
34 34
35 35
36 36
37 37
38 38
39 39
40 40
41 41
42 42
43 43
44 44
45 45
46 46
47 47
48 48
49 49
50 50
51 ...

result:

ok Operations: 100001

Test #122:

score: 25
Accepted
time: 21ms
memory: 16368kb

input:

babababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababa...

output:

100002
99998 86419
86420 0
1 86421
86422 2
3 86423
86424 4
5 86425
86426 6
7 86427
86428 8
9 86429
86430 10
11 86431
86432 12
13 86433
86434 14
15 86435
86436 16
17 86437
86438 18
19 86439
86440 20
21 86441
86442 22
23 86443
86444 24
25 86445
86446 26
27 86447
86448 28
29 86449
86450 30
31 86451
864...

result:

ok Operations: 100002

Test #123:

score: 25
Accepted
time: 17ms
memory: 17432kb

input:

babababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababa...

output:

100002
99998 4940
4941 0
1 4942
4943 2
3 4944
4945 4
5 4946
4947 6
7 4948
4949 8
9 4950
4951 10
11 4952
4953 12
13 4954
4955 14
15 4956
4957 16
17 4958
4959 18
19 4960
4961 20
21 4962
4963 22
23 4964
4965 24
25 4966
4967 26
27 4968
4969 28
29 4970
4971 30
31 4972
4973 32
33 4974
4975 34
35 4976
4977...

result:

ok Operations: 100002

Test #124:

score: 25
Accepted
time: 17ms
memory: 19808kb

input:

abababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababab...

output:

150000
50000 1
2 0
1 3
4 2
3 5
6 4
5 7
8 6
7 9
10 8
9 11
12 10
11 13
14 12
13 15
16 14
15 17
18 16
17 19
20 18
19 21
22 20
21 23
24 22
23 25
26 24
25 27
28 26
27 29
30 28
29 31
32 30
31 33
34 32
33 35
36 34
35 37
38 36
37 39
40 38
39 41
42 40
41 43
44 42
43 45
46 44
45 47
48 46
47 49
50 48
49 51
52 ...

result:

ok Operations: 150000

Test #125:

score: 25
Accepted
time: 33ms
memory: 19888kb

input:

babababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababa...

output:

200000
1 0
1 2
3 2
3 4
5 4
5 6
7 6
7 8
9 8
9 10
11 10
11 12
13 12
13 14
15 14
15 16
17 16
17 18
19 18
19 20
21 20
21 22
23 22
23 24
25 24
25 26
27 26
27 28
29 28
29 30
31 30
31 32
33 32
33 34
35 34
35 36
37 36
37 38
39 38
39 40
41 40
41 42
43 42
43 44
45 44
45 46
47 46
47 48
49 48
49 50
51 50
51 52
...

result:

ok Operations: 200000

Test #126:

score: 25
Accepted
time: 29ms
memory: 20812kb

input:

abababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababab...

output:

199999
1 0
1 2
3 2
3 4
5 4
5 6
7 6
7 8
9 8
9 10
11 10
11 12
13 12
13 14
15 14
15 16
17 16
17 18
19 18
19 20
21 20
21 22
23 22
23 24
25 24
25 26
27 26
27 28
29 28
29 30
31 30
31 32
33 32
33 34
35 34
35 36
37 36
37 38
39 38
39 40
41 40
41 42
43 42
43 44
45 44
45 46
47 46
47 48
49 48
49 50
51 50
51 52
...

result:

ok Operations: 199999

Test #127:

score: 25
Accepted
time: 26ms
memory: 18096kb

input:

babababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababa...

output:

199999
1 0
1 2
3 2
3 4
5 4
5 6
7 6
7 8
9 8
9 10
11 10
11 12
13 12
13 14
15 14
15 16
17 16
17 18
19 18
19 20
21 20
21 22
23 22
23 24
25 24
25 26
27 26
27 28
29 28
29 30
31 30
31 32
33 32
33 34
35 34
35 36
37 36
37 38
39 38
39 40
41 40
41 42
43 42
43 44
45 44
45 46
47 46
47 48
49 48
49 50
51 50
51 52
...

result:

ok Operations: 199999

Test #128:

score: 25
Accepted
time: 29ms
memory: 20224kb

input:

abababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababab...

output:

199999
2 1
0 1
3 2
3 4
5 4
5 6
7 6
7 8
9 8
9 10
11 10
11 12
13 12
13 14
15 14
15 16
17 16
17 18
19 18
19 20
21 20
21 22
23 22
23 24
25 24
25 26
27 26
27 28
29 28
29 30
31 30
31 32
33 32
33 34
35 34
35 36
37 36
37 38
39 38
39 40
41 40
41 42
43 42
43 44
45 44
45 46
47 46
47 48
49 48
49 50
51 50
51 52
...

result:

ok Operations: 199999

Test #129:

score: 25
Accepted
time: 28ms
memory: 19148kb

input:

abababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababab...

output:

199998
1 2
0 2
3 1
3 4
5 4
5 6
7 6
7 8
9 8
9 10
11 10
11 12
13 12
13 14
15 14
15 16
17 16
17 18
19 18
19 20
21 20
21 22
23 22
23 24
25 24
25 26
27 26
27 28
29 28
29 30
31 30
31 32
33 32
33 34
35 34
35 36
37 36
37 38
39 38
39 40
41 40
41 42
43 42
43 44
45 44
45 46
47 46
47 48
49 48
49 50
51 50
51 52
...

result:

ok Operations: 199998

Test #130:

score: 25
Accepted
time: 29ms
memory: 19444kb

input:

abababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababab...

output:

199998
2 1
2 0
1 3
4 3
4 5
6 5
6 7
8 7
8 9
10 9
10 11
12 11
12 13
14 13
14 15
16 15
16 17
18 17
18 19
20 19
20 21
22 21
22 23
24 23
24 25
26 25
26 27
28 27
28 29
30 29
30 31
32 31
32 33
34 33
34 35
36 35
36 37
38 37
38 39
40 39
40 41
42 41
42 43
44 43
44 45
46 45
46 47
48 47
48 49
50 49
50 51
52 51
...

result:

ok Operations: 199998

Test #131:

score: 25
Accepted
time: 21ms
memory: 14784kb

input:

aaababbaabbbbaababababababbbabbaaaababbabababbabaabbbabbabbbbabaaabbbaaabbababbaabbbaabbbababbaabbabaababbbaaaabbbababbbabbabaaaabbbababababaababaababbaabbbbbbabbaaabbbaaaababababaaabbbabbbaabaabbabaabababaaabaaabaaabababaabababbbaaababaaabaabbbbababaababbababbabaabbbaababababbbababaabbababbbabbbbaa...

output:

101948
32117 1
0 3
5 1
2 6
7 4
5 9
11 9
10 13
14 11
12 15
16 13
15 17
18 16
18 19
21 19
20 22
23 21
22 24
28 25
26 29
33 28
29 37
39 30
32 40
41 34
35 42
43 36
38 44
49 39
40 50
51 42
45 52
54 46
49 56
57 52
53 58
59 55
56 60
61 60
61 62
63 62
63 66
68 66
67 71
73 69
70 74
75 71
72 76
80 74
77 82
83...

result:

ok Operations: 101948

Test #132:

score: 25
Accepted
time: 20ms
memory: 17608kb

input:

aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa...

output:

100001
200000 100000
1 200000
200001 2
3 200002
200003 4
5 200004
200005 6
7 200006
200007 8
9 200008
200009 10
11 200010
200011 12
13 200012
200013 14
15 200014
200015 16
17 200016
200017 18
19 200018
200019 20
21 200020
200021 22
23 200022
200023 24
25 200024
200025 26
27 200026
200027 28
29 20002...

result:

ok Operations: 100001

Test #133:

score: 25
Accepted
time: 14ms
memory: 16960kb

input:

abababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababab...

output:

100001
100000 121207
121207 1
2 121208
121209 3
4 121210
121211 5
6 121212
121213 7
8 121214
121215 9
10 121216
121217 11
12 121218
121219 13
14 121220
121221 15
16 121222
121223 17
18 121224
121225 19
20 121226
121227 21
22 121228
121229 23
24 121230
121231 25
26 121232
121233 27
28 121234
121235 2...

result:

ok Operations: 100001

Test #134:

score: 25
Accepted
time: 13ms
memory: 13548kb

input:

aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa...

output:

100001
74153 99999
1 74154
74155 2
3 74156
74157 4
5 74158
74159 6
7 74160
74161 8
9 74162
74163 10
11 74164
74165 12
13 74166
74167 14
15 74168
74169 16
17 74170
74171 18
19 74172
74173 20
21 74174
74175 22
23 74176
74177 24
25 74178
74179 26
27 74180
74181 28
29 74182
74183 30
31 74184
74185 32
33...

result:

ok Operations: 100001

Test #135:

score: 25
Accepted
time: 20ms
memory: 17128kb

input:

babababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababa...

output:

100001
99999 86958
86959 1
2 86960
86961 3
4 86962
86963 5
6 86964
86965 7
8 86966
86967 9
10 86968
86969 11
12 86970
86971 13
14 86972
86973 15
16 86974
86975 17
18 86976
86977 19
20 86978
86979 21
22 86980
86981 23
24 86982
86983 25
26 86984
86985 27
28 86986
86987 29
30 86988
86989 31
32 86990
86...

result:

ok Operations: 100001

Test #136:

score: 25
Accepted
time: 20ms
memory: 16436kb

input:

abababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababab...

output:

100002
99999 13939
13940 1
2 13941
13942 3
4 13943
13944 5
6 13945
13946 7
8 13947
13948 9
10 13949
13950 11
12 13951
13952 13
14 13953
13954 15
16 13955
13956 17
18 13957
13958 19
20 13959
13960 21
22 13961
13962 23
24 13963
13964 25
26 13965
13966 27
28 13967
13968 29
30 13969
13970 31
32 13971
13...

result:

ok Operations: 100002

Test #137:

score: 25
Accepted
time: 21ms
memory: 17076kb

input:

babababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababa...

output:

150000
1 50001
1 2
3 2
3 4
5 4
5 6
7 6
7 8
9 8
9 10
11 10
11 12
13 12
13 14
15 14
15 16
17 16
17 18
19 18
19 20
21 20
21 22
23 22
23 24
25 24
25 26
27 26
27 28
29 28
29 30
31 30
31 32
33 32
33 34
35 34
35 36
37 36
37 38
39 38
39 40
41 40
41 42
43 42
43 44
45 44
45 46
47 46
47 48
49 48
49 50
51 50
51...

result:

ok Operations: 150000

Test #138:

score: 25
Accepted
time: 24ms
memory: 20120kb

input:

abababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababab...

output:

199999
1 1
2 2
3 3
4 4
5 5
6 6
7 7
8 8
9 9
10 10
11 11
12 12
13 13
14 14
15 15
16 16
17 17
18 18
19 19
20 20
21 21
22 22
23 23
24 24
25 25
26 26
27 27
28 28
29 29
30 30
31 31
32 32
33 33
34 34
35 35
36 36
37 37
38 38
39 39
40 40
41 41
42 42
43 43
44 44
45 45
46 46
47 47
48 48
49 49
50 50
51 51
52 52...

result:

ok Operations: 199999

Test #139:

score: 25
Accepted
time: 25ms
memory: 20680kb

input:

babababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababa...

output:

199998
1 1
2 2
3 3
4 4
5 5
6 6
7 7
8 8
9 9
10 10
11 11
12 12
13 13
14 14
15 15
16 16
17 17
18 18
19 19
20 20
21 21
22 22
23 23
24 24
25 25
26 26
27 27
28 28
29 29
30 30
31 31
32 32
33 33
34 34
35 35
36 36
37 37
38 38
39 39
40 40
41 41
42 42
43 43
44 44
45 45
46 46
47 47
48 48
49 49
50 50
51 51
52 52...

result:

ok Operations: 199998

Test #140:

score: 25
Accepted
time: 29ms
memory: 20344kb

input:

abababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababab...

output:

199999
1 1
2 2
3 3
4 4
5 5
6 6
7 7
8 8
9 9
10 10
11 11
12 12
13 13
14 14
15 15
16 16
17 17
18 18
19 19
20 20
21 21
22 22
23 23
24 24
25 25
26 26
27 27
28 28
29 29
30 30
31 31
32 32
33 33
34 34
35 35
36 36
37 37
38 38
39 39
40 40
41 41
42 42
43 43
44 44
45 45
46 46
47 47
48 48
49 49
50 50
51 51
52 52...

result:

ok Operations: 199999

Test #141:

score: 25
Accepted
time: 27ms
memory: 20252kb

input:

abababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababab...

output:

199999
2 1
1 1
2 2
3 3
4 4
5 5
6 6
7 7
8 8
9 9
10 10
11 11
12 12
13 13
14 14
15 15
16 16
17 17
18 18
19 19
20 20
21 21
22 22
23 23
24 24
25 25
26 26
27 27
28 28
29 29
30 30
31 31
32 32
33 33
34 34
35 35
36 36
37 37
38 38
39 39
40 40
41 41
42 42
43 43
44 44
45 45
46 46
47 47
48 48
49 49
50 50
51 51
5...

result:

ok Operations: 199999

Test #142:

score: 25
Accepted
time: 18ms
memory: 20404kb

input:

abababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababab...

output:

199998
1 3
1 2
3 2
4 4
5 5
6 6
7 7
8 8
9 9
10 10
11 11
12 12
13 13
14 14
15 15
16 16
17 17
18 18
19 19
20 20
21 21
22 22
23 23
24 24
25 25
26 26
27 27
28 28
29 29
30 30
31 31
32 32
33 33
34 34
35 35
36 36
37 37
38 38
39 39
40 40
41 41
42 42
43 43
44 44
45 45
46 46
47 47
48 48
49 49
50 50
51 51
52 52...

result:

ok Operations: 199998

Test #143:

score: 25
Accepted
time: 29ms
memory: 20380kb

input:

abababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababab...

output:

199997
3 1
2 1
2 3
4 4
5 5
6 6
7 7
8 8
9 9
10 10
11 11
12 12
13 13
14 14
15 15
16 16
17 17
18 18
19 19
20 20
21 21
22 22
23 23
24 24
25 25
26 26
27 27
28 28
29 29
30 30
31 31
32 32
33 33
34 34
35 35
36 36
37 37
38 38
39 39
40 40
41 41
42 42
43 43
44 44
45 45
46 46
47 47
48 48
49 49
50 50
51 51
52 52...

result:

ok Operations: 199997

Test #144:

score: 25
Accepted
time: 16ms
memory: 14588kb

input:

aaabaaaababababbaabababbabaaaaaabbaabababbaabbbabaabaaaabbaabbbabbaaababbbaabbbbaabaabaaabaabaabaabababaaaabaaabaabbbbabbababbbabbaababababbabbaabbbbabaaababbbabbabaaaabbabaabaaaabbbababaaaabaababababbaabbbbababababaaabaabbbbabaaababbbababababbaaabaaaabaabbaababbaababbabbabbababababbababbbabbbbaaaaa...

output:

101948
32039 3
3 3
4 4
5 8
9 6
8 10
11 9
10 12
13 11
13 14
15 15
16 17
19 17
18 20
22 19
20 23
31 22
23 32
33 24
27 39
42 29
30 44
45 31
33 46
48 34
37 49
52 39
40 54
56 43
44 57
58 45
51 60
62 52
54 66
67 56
57 69
70 60
61 71
74 63
65 77
78 66
67 79
80 70
72 82
83 76
78 85
86 79
81 88
89 82
83 92
9...

result:

ok Operations: 101948

Extra Test:

score: 0
Extra Test Passed