QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#282093#325. AB-Stringswhdywjd100 ✓23ms18752kbC++144.2kb2023-12-11 13:16:062024-08-09 00:12:35

Judging History

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

  • [2024-08-09 00:12:35]
  • 管理员手动重测本题所有提交记录
  • 测评结果:100
  • 用时:23ms
  • 内存:18752kb
  • [2023-12-11 13:16:08]
  • 评测
  • 测评结果:100
  • 用时:22ms
  • 内存:18580kb
  • [2023-12-11 13:16:06]
  • 提交

answer

#include <cstdio>
#include <algorithm>
#include <cstring>
#include <vector>
#include <queue>
#define ll long long
#define lf double
#define _1 first
#define _2 second
#define _mp make_pair
#define _pb push_back
#define inf 22222222222222ll
#define MAX_N 522222

using namespace std;

ll read(){ll x = 0;char c = 0, v = 0;do{c = getchar();if(c == '-')v = 1;} while(c < '0' || c > '9');do{x = (x << 3) + (x << 1) + c - '0';c = getchar();} while(c >= '0' && c <= '9');if(v)return -x;return x;}

int n, m;

struct node
{
    char c;
    int len;
};

char s[MAX_N], t[MAX_N];
vector<pair<int, int> > opps;
node a[MAX_N], b[MAX_N];
node tmpx[MAX_N], tmpy[MAX_N];

void input()
{
    scanf("%s", s);
    scanf("%s", t);
    int sl = strlen(s), tl = strlen(t);
    n = m = 0;
    for(int i = sl - 1; ~i; i--)
        if(!n || s[i] != a[n - 1].c)
            a[n++] = (node){s[i], 1};
        else
            a[n - 1].len++;
    for(int i = tl - 1; ~i; i--)
        if(!m || t[i] != b[m - 1].c)
            b[m++] = (node){t[i], 1};
        else
            b[m - 1].len++;
}

void opt(int x, int y)
{
    int sumx = 0, sumy = 0;
    for(int i = n - 1; i >= n - x; i--)
        sumx += a[i].len, tmpx[i - (n - x)] = a[i];
    for(int i = m - 1; i >= m - y; i--)
        sumy += b[i].len, tmpy[i - (m - y)] = b[i];
    opps._pb(_mp(sumx, sumy));
    n -= x, m -= y;
    if(n && y && tmpy[0].c == a[n - 1].c)
        a[n - 1].len += tmpy[0].len;
    else if(y)
        a[n++] = tmpy[0];
    for(int i = 1; i <= y - 1; i++)
        a[n++] = tmpy[i];
    if(m && x && tmpx[0].c == b[m - 1].c)
        b[m - 1].len += tmpx[0].len;
    else if(x)
        b[m++] = tmpx[0];
    for(int i = 1; i <= x - 1; i++)
        b[m++] = tmpx[i];
    /*printf("opt %d %d %d %d\n", n, m, x, y);
    for(int i = 0; i < n; i++)
        printf("%c %d\n", a[i].c, a[i].len);
    printf("\n");
    for(int i = 0; i < m; i++)
        printf("%c %d\n", b[i].c, b[i].len);*/
}

void mree()
{
    while(n >= 4 && m >= 4)
        if(a[n - 1].c == b[m - 1].c)
            opt(1, 2), opt(2, 1);
        else
            opt(1, 1);
}

void parr()
{
    if(n >= 3 && m == 1)
    {
        int pos = n, val = n - 1;
        for(int i = 1; i < n; i++)
        {
            int d = abs(i - (n - i));
            if(d < val)
                val = d, pos = i;
        }
        if(pos != n)
            if(a[pos].c == b[0].c)
                opt(n - pos, 0);
            else
                opt(n - pos, 1);
        return;
    }
    if(m >= 3 && n == 1)
    {
        /*for(int i = 0; i < n; i++)
            printf("%c %d\n", a[i].c, a[i].len);
        printf("\n");
        for(int i = 0; i < m; i++)
            printf("%c %d\n", b[i].c, b[i].len);*/
        int pos = m, val = m - 1;
        for(int i = 1; i < m; i++)
        {
            //printf("%d\n", i);
            int d = abs(i - (m - i));
            if(d < val)
                val = d, pos = i;
        }
        if(pos != m)
            if(b[pos].c == a[0].c)
                opt(0, m - pos);
            else
                opt(1, m - pos);
        return;
    }
    int pi = n, pj = m, val = n + m + 1;
    for(int i = 1; i < n; i++)
        for(int j = 1; j < m; j++)
            if(a[i].c == b[j - 1].c && a[i - 1].c == b[j].c)
            {
                int d = abs((i + (m - j) - 1) - (j + (n - i) - 1));
                if(d < val)
                    val = d, pi = i, pj = j;
            }
    if(pi != n && pj != m)
        opt(n - pi, m - pj);
    return;
}

void bass()
{
    //printf("%d %d\n", n, m);
    if(n == 1 && m == 1)
        return;
    if(a[n - 1].c != b[m - 1].c)
    {
        while(!(n == 1 && m == 1) && a[n - 1].c != b[m - 1].c)
            opt(1, 1);
        return;
    }
    if(n == 1)
        opt(0, 1), bass();
    else if(m == 1)
        opt(1, 0), bass();
    else if(n > m)
        opt(2, 1), bass();
    else
        opt(1, 2), bass();
}

void output()
{
    printf("%d\n", (int)opps.size());
    for(auto i: opps)
        printf("%d %d\n", i._1, i._2);
}

int main()
{
    input(), mree(), parr(), mree(), bass(), output();
    return 0;
}

Details

Tip: Click on the bar to expand more detailed information

Subtask #1:

score: 5
Accepted

Test #1:

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

input:

a
b

output:

0

result:

ok Operations: 0

Test #2:

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

input:

b
a

output:

0

result:

ok Operations: 0

Test #3:

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

input:

a
bb

output:

0

result:

ok Operations: 0

Test #4:

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

input:

b
ab

output:

1
1 1

result:

ok Operations: 1

Test #5:

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

input:

b
ba

output:

1
0 1

result:

ok Operations: 1

Test #6:

score: 5
Accepted
time: 2ms
memory: 11988kb

input:

ab
bb

output:

1
1 2

result:

ok Operations: 1

Test #7:

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

input:

ba
bb

output:

1
1 0

result:

ok Operations: 1

Test #8:

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

input:

bab
bbb

output:

2
2 3
0 1

result:

ok Operations: 2

Test #9:

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

input:

abb
bbb

output:

1
1 3

result:

ok Operations: 1

Test #10:

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

input:

a
bbbb

output:

0

result:

ok Operations: 0

Test #11:

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

input:

abbb
b

output:

1
1 1

result:

ok Operations: 1

Test #12:

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

input:

b
bbba

output:

1
0 3

result:

ok Operations: 1

Test #13:

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

input:

bbb
abbbb

output:

1
3 1

result:

ok Operations: 1

Test #14:

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

input:

bbbbba
bbbb

output:

1
5 0

result:

ok Operations: 1

Test #15:

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

input:

abbbbb
bbbbbb

output:

1
1 6

result:

ok Operations: 1

Test #16:

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

input:

bbbbba
bbbbbb

output:

1
5 0

result:

ok Operations: 1

Test #17:

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

input:

bbbbbb
bbbbba

output:

1
0 5

result:

ok Operations: 1

Test #18:

score: 5
Accepted
time: 2ms
memory: 12080kb

input:

bbabbb
bbbbbb

output:

2
3 6
0 2

result:

ok Operations: 2

Test #19:

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

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: 1ms
memory: 9956kb

input:

aaaaaa
bbbbbb

output:

0

result:

ok Operations: 0

Test #21:

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

input:

aaaaaa
aaaabb

output:

1
0 4

result:

ok Operations: 1

Test #22:

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

input:

aaaaba
aaaaaa

output:

2
5 6
0 4

result:

ok Operations: 2

Test #23:

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

input:

bbabba
bbbbbb

output:

3
3 6
8 3
2 0

result:

ok Operations: 3

Test #24:

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

input:

bbabab
bbbbbb

output:

3
4 0
1 2
3 2

result:

ok Operations: 3

Test #25:

score: 10
Accepted
time: 2ms
memory: 12064kb

input:

bbbbbb
bababa

output:

3
0 3
1 1
2 2

result:

ok Operations: 3

Test #26:

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

input:

bbbbba
bbbba

output:

2
5 5
4 0

result:

ok Operations: 2

Test #27:

score: 10
Accepted
time: 2ms
memory: 12016kb

input:

aaaaba
aaabbb

output:

2
5 3
0 4

result:

ok Operations: 2

Test #28:

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

input:

bbbbba
baaaba

output:

3
5 4
1 7
6 0

result:

ok Operations: 3

Test #29:

score: 10
Accepted
time: 2ms
memory: 11996kb

input:

baabab
bbbbaa

output:

3
3 4
6 1
0 5

result:

ok Operations: 3

Test #30:

score: 10
Accepted
time: 2ms
memory: 12080kb

input:

bababa
bbbaaa

output:

4
4 3
4 2
1 9
5 0

result:

ok Operations: 4

Test #31:

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

input:

abbbba
aaaaba

output:

3
5 4
0 1
6 5

result:

ok Operations: 3

Test #32:

score: 10
Accepted
time: 2ms
memory: 12088kb

input:

abbaa
abbabb

output:

3
3 4
3 1
0 1

result:

ok Operations: 3

Test #33:

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

input:

baabab
bbbabb

output:

4
4 4
3 3
1 0
4 7

result:

ok Operations: 4

Test #34:

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

input:

bababa
bbbabb

output:

4
3 4
5 1
2 6
3 0

result:

ok Operations: 4

Test #35:

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

input:

baabaa
baabaa

output:

4
1 3
5 2
3 7
1 0

result:

ok Operations: 4

Test #36:

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

input:

bbbaba
bababb

output:

4
3 2
3 4
5 4
1 0

result:

ok Operations: 4

Test #37:

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

input:

bababa
bbabaa

output:

5
1 3
4 2
4 2
3 8
3 0

result:

ok Operations: 5

Test #38:

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

input:

babaab
bbabab

output:

5
1 3
4 2
5 2
0 3
6 5

result:

ok Operations: 5

Test #39:

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

input:

bbabab
bababa

output:

5
2 2
3 3
5 5
4 4
0 1

result:

ok Operations: 5

Test #40:

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

input:

bababa
bababa

output:

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

result:

ok Operations: 6

Test #41:

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

input:

bbbbba
aaaaaa

output:

1
5 6

result:

ok Operations: 1

Test #42:

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

input:

aabaaa
bbbbbb

output:

2
3 0
0 2

result:

ok Operations: 2

Test #43:

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

input:

bbabba
aaaaaa

output:

3
3 0
2 9
2 0

result:

ok Operations: 3

Test #44:

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

input:

abbaba
bbbbbb

output:

3
4 6
7 1
2 9

result:

ok Operations: 3

Test #45:

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

input:

bbbbbb
ababab

output:

3
6 3
1 7
8 2

result:

ok Operations: 3

Test #46:

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

input:

bbbaa
aaaabb

output:

1
3 4

result:

ok Operations: 1

Test #47:

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

input:

bbbbba
aabaaa

output:

2
5 2
3 6

result:

ok Operations: 2

Test #48:

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

input:

bbaaaa
aababb

output:

3
2 4
2 4
5 2

result:

ok Operations: 3

Test #49:

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

input:

bbbbaa
abbaba

output:

3
4 4
1 5
7 2

result:

ok Operations: 3

Test #50:

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

input:

bababa
aaaabb

output:

3
3 4
5 1
2 6

result:

ok Operations: 3

Test #51:

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

input:

bbaaab
abaaaa

output:

2
5 2
1 2

result:

ok Operations: 2

Test #52:

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

input:

baabaa
aabba

output:

3
3 4
2 1
4 5

result:

ok Operations: 3

Test #53:

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

input:

babbab
abbbaa

output:

4
5 4
1 1
5 2
2 7

result:

ok Operations: 4

Test #54:

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

input:

aaabba
bababa

output:

4
5 4
1 3
4 4
5 5

result:

ok Operations: 4

Test #55:

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

input:

aabbab
baaaba

output:

3
2 1
4 6
5 3

result:

ok Operations: 3

Test #56:

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

input:

baabab
aabbab

output:

4
1 2
5 4
3 4
6 5

result:

ok Operations: 4

Test #57:

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

input:

bbabba
ababab

output:

5
2 1
4 6
3 2
3 6
7 3

result:

ok Operations: 5

Test #58:

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

input:

aababa
baabab

output:

4
2 1
2 4
6 4
3 5

result:

ok Operations: 4

Test #59:

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

input:

babaab
ababab

output:

5
1 1
2 2
5 4
3 3
5 6

result:

ok Operations: 5

Test #60:

score: 10
Accepted
time: 2ms
memory: 11996kb

input:

ababab
bababa

output:

5
1 1
2 2
3 3
5 5
4 4

result:

ok Operations: 5

Subtask #3:

score: 20
Accepted

Dependency #1:

100%
Accepted

Dependency #2:

100%
Accepted

Test #61:

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

input:

bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa

output:

0

result:

ok Operations: 0

Test #62:

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

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: 0ms
memory: 11960kb

input:

aaaaaaaaaaaaaaaaaaabbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb
ababababababababababababababababababababababababab

output:

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

result:

ok Operations: 26

Test #64:

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

input:

bbbbbbbbbbbbbbbbbbbbbbbbbbbbaabbbbbbbbbbbbbbbbbbbb
bababababababababababababababababababababababababa

output:

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

result:

ok Operations: 26

Test #65:

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

input:

bababababababababababababababababababababababababa
bbbbbbbbbbbbbbbbbbbaaaaaaaaabbbbbbbbbbbbbbbbbbbbaa

output:

27
1 28
29 21
45 19
20 23
24 21
22 25
26 23
24 27
28 25
26 29
30 27
28 31
32 29
30 33
34 31
32 35
36 33
34 37
38 35
36 39
40 37
38 41
42 39
40 43
44 41
42 57
22 0

result:

ok Operations: 27

Test #66:

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

input:

ababababababababababababababababababababababababa
aabbbabbbbabbbaabbbabbaabaaaaabaaabaabaababbaaba

output:

37
1 5
6 2
3 10
11 4
5 14
15 7
8 18
19 9
10 21
22 12
13 23
24 18
19 25
26 22
23 27
28 25
26 29
30 28
29 31
32 30
31 34
35 33
48 36
2 35
70 3
4 71
72 5
6 73
74 7
8 75
76 9
10 77
78 11
12 79
34 14
13 0
47 49

result:

ok Operations: 37

Test #67:

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

input:

bababababababababababababababababababababababababa
bababababababababababababababababababababababababa

output:

50
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
1 0

result:

ok Operations: 50

Test #68:

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

input:

ababababababababababababababababababababababababab
ababababababababababababababababababababababaababa

output:

49
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 45
46 46
47 47
50 48
1 49
48 0

result:

ok Operations: 49

Test #69:

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

input:

ababababababababababababababbababababababababababa
abababababababababababababababababaabababababababa

output:

49
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
30 28
29 31
32 30
31 33
34 32
33 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
49 1
0 48
50 49

result:

ok Operations: 49

Test #70:

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

input:

abababababababababababababaabababababababbabababab
ababababababababababababababababababababababababab

output:

49
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 36
37 37
38 38
39 39
40 40
42 41
42 43
44 43
44 45
46 45
46 47
48 47
48 49
1 50
49 0

result:

ok Operations: 49

Test #71:

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

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: 0ms
memory: 10044kb

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: 12084kb

input:

bbbbbbbbbbbbbbaaaaaaaaaaaaaaaaaaaaabbbbbbbbbbbbbbb
ababababababababababababababababababababababababab

output:

26
35 26
1 14
15 23
24 16
17 25
26 18
19 27
28 20
21 29
30 22
23 31
32 24
25 33
34 26
27 35
36 28
29 37
38 30
31 39
40 32
33 41
42 34
35 43
44 36
37 45
46 38

result:

ok Operations: 26

Test #74:

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

input:

bababababababababababababababababababababababababa
aaabbbbbbbbbbbbbbbbbbbbbbbbbbbaaaaaaaaaaaaaaabbbbb

output:

27
1 3
29 43
28 4
20 29
30 21
22 31
32 23
24 33
34 25
26 35
36 27
28 37
38 29
30 39
40 31
32 41
42 33
34 43
44 35
36 45
46 37
38 47
48 39
40 49
50 41
42 51
51 43

result:

ok Operations: 27

Test #75:

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

input:

ababababababababababababababababababababababababa
babbaaaabbbbabbaaabbaabbaaababbaaaabaababaabaaab

output:

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

result:

ok Operations: 36

Test #76:

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

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
49 49
48 48

result:

ok Operations: 49

Test #77:

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

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
49 48
47 48
50 49

result:

ok Operations: 49

Test #78:

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

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
50 48
47 49

result:

ok Operations: 48

Test #79:

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

input:

bababababababababababababababababababababababababa
aabababababababababababababababababababababababaab

output:

49
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
50 48
46 47
50 47
47 51

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: 9904kb

input:

aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb...

output:

0

result:

ok Operations: 0

Test #81:

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

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: 10104kb

input:

aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaabbb
ababababababababababababababababababababababababa...

output:

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

result:

ok Operations: 126

Test #83:

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

input:

ababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababab
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa...

output:

126
125 199
146 2
56 147
148 57
58 149
150 59
60 151
152 61
62 153
154 63
64 155
156 65
66 157
158 67
68 159
160 69
70 161
162 71
72 163
164 73
74 165
166 75
76 167
168 77
78 169
170 79
80 171
172 81
82 173
174 83
84 175
176 85
86 177
178 87
88 179
180 89
90 181
182 91
92 183
184 93
94 185
186 95
96...

result:

ok Operations: 126

Test #84:

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

input:

bababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababa
bbbbbbbbbbaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa...

output:

127
1 80
81 120
244 10
11 122
123 12
13 124
125 14
15 126
127 16
17 128
129 18
19 130
131 20
21 132
133 22
23 134
135 24
25 136
137 26
27 138
139 28
29 140
141 30
31 142
143 32
33 144
145 34
35 146
147 36
37 148
149 38
39 150
151 40
41 152
153 42
43 154
155 44
45 156
157 46
47 158
159 48
49 160
161 ...

result:

ok Operations: 127

Test #85:

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

input:

ababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababab
ababababababababababababababababababababababababa...

output:

250
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 52
5...

result:

ok Operations: 250

Test #86:

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

input:

ababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababab
ababababababababababababababababababaabababababab...

output:

249
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 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 53
5...

result:

ok Operations: 249

Test #87:

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

input:

abababababababababababababababababababababababababababababababababababababababababaabababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababa
ababababababababababababababababababababababababa...

output:

249
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 52
5...

result:

ok Operations: 249

Test #88:

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

input:

bababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababaabababababababababababababababababababababababababa
bababaabaaaaabababbaababbbbbbabbabbabbbbbabbaaabba...

output:

199
1 2
3 2
3 4
5 4
5 7
8 6
7 13
14 8
9 15
16 10
11 17
18 13
14 20
21 15
16 22
23 22
23 24
25 25
26 26
27 28
29 28
29 34
35 30
31 37
38 34
35 40
41 37
38 43
44 40
41 46
47 42
43 48
49 44
45 50
51 46
47 53
54 50
51 58
59 53
54 60
61 55
56 63
64 58
59 65
66 61
62 73
74 64
65 75
76 68
69 77
78 71
72 80...

result:

ok Operations: 199

Test #89:

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

input:

abababababaabbaaabababababababbbaaababaaabbaababaababaabababaabaababbabababaababaabababababaabbabaabaabbabababbabbaaabaabababababababaababbaabaababbbabababaaabaabaabbababababbabaabaababbabbaababababaabbababaaabbaababaabaababababababbaabaabababbababba
aaaaaaaaaaaabbbaaabaaaaabbbbbbbbbbbaaaaaaaaaaabbb...

output:

111
1 15
16 4
5 17
18 10
11 29
30 22
23 37
38 27
28 40
41 46
48 62
64 57
60 68
69 66
67 86
87 69
70 94
95 71
72 108
109 75
76 110
111 78
79 129
130 81
82 142
145 111
114 148
149 115
223 158
12 117
264 15
16 266
269 18
19 270
271 20
21 272
273 23
24 274
275 25
28 276
277 30
32 278
279 33
35 280
282 3...

result:

ok Operations: 111

Test #90:

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

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: 0ms
memory: 9968kb

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: 2ms
memory: 11956kb

input:

aaaaabbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
babababababababababababababababababababababababab...

output:

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

result:

ok Operations: 126

Test #93:

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

input:

bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaabbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
ababababababababababababababababababababababababa...

output:

127
124 1
73 250
125 33
34 166
167 35
36 168
169 37
38 170
171 39
40 172
173 41
42 174
175 43
44 176
177 45
46 178
179 47
48 180
181 49
50 182
183 51
52 184
185 53
54 186
187 55
56 188
189 57
58 190
191 59
60 192
193 61
62 194
195 63
64 196
197 65
66 198
199 67
68 200
201 69
70 202
203 71
72 204
205...

result:

ok Operations: 127

Test #94:

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

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: 10032kb

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: 0ms
memory: 11996kb

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: 10108kb

input:

ababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababbabababababababab
bababbaababbbababababaabaabbbbabbaaaababbbababaaab...

output:

199
1 1
2 2
3 3
4 4
5 6
7 7
8 8
9 9
10 12
13 11
12 14
15 13
14 16
17 15
16 18
19 17
18 20
21 20
21 22
23 23
24 27
28 25
26 30
31 30
31 32
33 32
33 36
37 34
35 38
39 36
37 40
41 40
41 42
43 42
43 45
46 44
45 47
48 46
47 49
50 48
49 52
53 52
53 55
56 56
57 61
62 59
60 66
67 61
62 69
70 63
64 71
72 66
...

result:

ok Operations: 199

Test #98:

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

input:

aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaabbbbbbbbbbaaaaaaaaabbbbbaabbbbbbbbbbbaaaabbbaaaabbbbbbbbabbbaaaaaaaaaabbbbbaaaaaaaaaaaabbbbbbbbbaaabbbbbbbbbbbbbbbaaaaaaaaaaaaaaaabaaaaaaaaaaabbbbbbbbbbbbbbbbbaaaaaabbbbbbbbaaaaabbbbbbbbbbbbaaaaaaaabbbbbbbbbbbbbaaabaaa
baababababaabababbabababababbababababababababaaaba...

output:

110
31 1
11 33
42 12
17 43
45 18
29 46
50 30
33 51
55 34
42 57
58 43
46 59
69 47
52 70
82 54
63 83
86 64
79 87
103 80
81 104
115 82
99 116
122 100
108 123
128 110
122 129
137 123
136 138
142 248
137 141
142 139
140 143
144 141
142 145
146 146
147 147
148 148
149 149
150 151
152 152
153 154
155 154
1...

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: 7980kb

input:

aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa...

output:

0

result:

ok Operations: 0

Test #100:

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

input:

bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb...

output:

1001
2000 1000
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 203...

result:

ok Operations: 1001

Test #101:

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

input:

abababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababab...

output:

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

result:

ok Operations: 1001

Test #102:

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

input:

aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaabbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb...

output:

1001
1791 1001
1 1792
1793 2
3 1794
1795 4
5 1796
1797 6
7 1798
1799 8
9 1800
1801 10
11 1802
1803 12
13 1804
1805 14
15 1806
1807 16
17 1808
1809 18
19 1810
1811 20
21 1812
1813 22
23 1814
1815 24
25 1816
1817 26
27 1818
1819 28
29 1820
1821 30
31 1822
1823 32
33 1824
1825 34
35 1826
1827 36
37 182...

result:

ok Operations: 1001

Test #103:

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

input:

bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa...

output:

1002
222 2
1435 223
247 2434
1 249
1684 2
3 1685
1686 4
5 1687
1688 6
7 1689
1690 8
9 1691
1692 10
11 1693
1694 12
13 1695
1696 14
15 1697
1698 16
17 1699
1700 18
19 1701
1702 20
21 1703
1704 22
23 1705
1706 24
25 1707
1708 26
27 1709
1710 28
29 1711
1712 30
31 1713
1714 32
33 1715
1716 34
35 1717
1...

result:

ok Operations: 1002

Test #104:

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

input:

abababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababab...

output:

2000
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 52
...

result:

ok Operations: 2000

Test #105:

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

input:

babababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababa...

output:

1999
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 52
...

result:

ok Operations: 1999

Test #106:

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

input:

babababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababa...

output:

1999
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 52
...

result:

ok Operations: 1999

Test #107:

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

input:

abababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababab...

output:

1998
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 52
...

result:

ok Operations: 1998

Test #108:

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

input:

aaaaaaaaabbbbaaaaaabbbbbbaaaaabbbbbbbbbbbbbbbbbbbbbbaaabbbbaaaabaabbabbaaaabbbaaaaaaaaaabbbbbbaaaabbbbbbbbbbbbbabbbbbbbaaaabbbbbbbaaaaaabbbbbbbbbbbabbbaaababbaaaaaaaaaaaaaaaaabbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbabbbaaaaaabbbbbbbbbbbbaaabbbbbbbbaaaaaaabbaaaaaaaaabbbbbbbaabaaaaaaaaaaaaaaaaabbbbbbbbb...

output:

1114
9 3
7 11
17 8
14 18
23 15
37 24
27 38
42 28
32 43
44 34
36 45
47 37
38 48
50 39
43 51
54 44
54 55
61 55
59 62
75 60
61 76
83 62
66 84
91 67
73 92
103 74
75 104
107 76
79 108
109 80
81 112
114 82
99 115
153 101
102 154
157 103
109 159
171 110
113 172
180 114
121 181
183 122
131 184
191 132
134 1...

result:

ok Operations: 1114

Test #109:

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

input:

abababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababab...

output:

1001
1000 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: 1001

Test #110:

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

input:

babababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababa...

output:

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

result:

ok Operations: 1001

Test #111:

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

input:

babababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababa...

output:

1001
1000 1986
300 1
1688 301
302 1689
1690 303
304 1691
1692 305
306 1693
1694 307
308 1695
1696 309
310 1697
1698 311
312 1699
1700 313
314 1701
1702 315
316 1703
1704 317
318 1705
1706 319
320 1707
1708 321
322 1709
1710 323
324 1711
1712 325
326 1713
1714 327
328 1715
1716 329
330 1717
1718 331
...

result:

ok Operations: 1001

Test #112:

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

input:

aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa...

output:

1001
559 1
861 1559
560 376
377 1046
1047 378
379 1048
1049 380
381 1050
1051 382
383 1052
1053 384
385 1054
1055 386
387 1056
1057 388
389 1058
1059 390
391 1060
1061 392
393 1062
1063 394
395 1064
1065 396
397 1066
1067 398
399 1068
1069 400
401 1070
1071 402
403 1072
1073 404
405 1074
1075 406
40...

result:

ok Operations: 1001

Test #113:

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

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: 0ms
memory: 10140kb

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: 9940kb

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: 2ms
memory: 12096kb

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: 2ms
memory: 10064kb

input:

abababababababababababababaababaabababababababababababababababababababaababababababababababababababababababababababababababababababababababaabababababababababababababababababababababababababababbabababababababaababababababababababababababababababababababababaabababbabababababababababababababbabababa...

output:

1114
1 6
7 5
6 20
21 32
33 38
39 34
35 40
41 44
45 44
45 50
51 52
53 63
64 68
69 72
73 79
80 79
80 92
93 81
82 96
97 91
92 99
100 100
101 111
112 105
106 120
121 121
123 127
128 151
152 129
130 168
170 131
132 179
180 134
135 190
191 145
146 203
204 156
157 209
210 158
159 215
216 167
168 222
223 17...

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: 3ms
memory: 9904kb

input:

bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb...

output:

0

result:

ok Operations: 0

Test #119:

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

input:

aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa...

output:

100001
200000 100000
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 20003...

result:

ok Operations: 100001

Test #120:

score: 25
Accepted
time: 11ms
memory: 18572kb

input:

abababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababab...

output:

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

result:

ok Operations: 100001

Test #121:

score: 25
Accepted
time: 11ms
memory: 17560kb

input:

aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa...

output:

100001
184371 100001
1 184372
184373 2
3 184374
184375 4
5 184376
184377 6
7 184378
184379 8
9 184380
184381 10
11 184382
184383 12
13 184384
184385 14
15 184386
184387 16
17 184388
184389 18
19 184390
184391 20
21 184392
184393 22
23 184394
184395 24
25 184396
184397 26
27 184398
184399 28
29 18440...

result:

ok Operations: 100001

Test #122:

score: 25
Accepted
time: 7ms
memory: 18556kb

input:

babababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababa...

output:

100002
1 114808
114809 74724
174724 86419
86420 74726
74727 86421
86422 74728
74729 86423
86424 74730
74731 86425
86426 74732
74733 86427
86428 74734
74735 86429
86430 74736
74737 86431
86432 74738
74739 86433
86434 74740
74741 86435
86436 74742
74743 86437
86438 74744
74745 86439
86440 74746
74747 ...

result:

ok Operations: 100002

Test #123:

score: 25
Accepted
time: 15ms
memory: 18752kb

input:

babababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababa...

output:

100002
1 44745
44746 48466
148465 142816
4940 48468
186345 4941
4942 186346
186347 4943
4944 186348
186349 4945
4946 186350
186351 4947
4948 186352
186353 4949
4950 186354
186355 4951
4952 186356
186357 4953
4954 186358
186359 4955
4956 186360
186361 4957
4958 186362
186363 4959
4960 186364
186365 4...

result:

ok Operations: 100002

Test #124:

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

input:

abababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababab...

output:

150000
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 5...

result:

ok Operations: 150000

Test #125:

score: 25
Accepted
time: 22ms
memory: 11808kb

input:

babababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababa...

output:

200000
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 5...

result:

ok Operations: 200000

Test #126:

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

input:

abababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababab...

output:

199999
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 5...

result:

ok Operations: 199999

Test #127:

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

input:

babababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababa...

output:

199999
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 5...

result:

ok Operations: 199999

Test #128:

score: 25
Accepted
time: 15ms
memory: 15848kb

input:

abababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababab...

output:

199999
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 5...

result:

ok Operations: 199999

Test #129:

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

input:

abababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababab...

output:

199998
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 5...

result:

ok Operations: 199998

Test #130:

score: 25
Accepted
time: 19ms
memory: 17636kb

input:

abababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababab...

output:

199998
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 5...

result:

ok Operations: 199998

Test #131:

score: 25
Accepted
time: 11ms
memory: 12404kb

input:

aaababbaabbbbaababababababbbabbaaaababbabababbabaabbbabbabbbbabaaabbbaaabbababbaabbbaabbbababbaabbabaababbbaaaabbbababbbabbabaaaabbbababababaababaababbaabbbbbbabbaaabbbaaaababababaaabbbabbbaabaabbabaabababaaabaaabaaabababaabababbbaaababaaabaabbbbababaababbababbabaabbbaababababbbababaabbababbbabbbbaa...

output:

101948
3 3
4 4
5 5
7 8
10 10
14 11
13 15
16 15
16 17
18 19
20 22
23 23
24 25
26 25
26 29
30 27
28 37
40 30
31 41
43 34
38 47
48 47
48 51
53 54
55 54
55 58
59 58
59 61
62 61
63 65
66 68
69 68
70 71
74 71
72 76
78 74
75 81
85 79
80 87
88 83
86 95
98 92
95 99
101 99
100 103
104 103
104 106
108 109
111 ...

result:

ok Operations: 101948

Test #132:

score: 25
Accepted
time: 9ms
memory: 11612kb

input:

aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa...

output:

100001
0 100000
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
5...

result:

ok Operations: 100001

Test #133:

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

input:

abababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababab...

output:

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

result:

ok Operations: 100001

Test #134:

score: 25
Accepted
time: 9ms
memory: 11616kb

input:

aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa...

output:

100001
106314 100000
1 74153
74154 32163
32164 74155
74156 32165
32166 74157
74158 32167
32168 74159
74160 32169
32170 74161
74162 32171
32172 74163
74164 32173
32174 74165
74166 32175
32176 74167
74168 32177
32178 74169
74170 32179
32180 74171
74172 32181
32182 74173
74174 32183
32184 74175
74176 3...

result:

ok Operations: 100001

Test #135:

score: 25
Accepted
time: 4ms
memory: 12768kb

input:

babababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababa...

output:

100001
1 86958
186958 25351
4463 86959
107848 4464
4465 107849
107850 4466
4467 107851
107852 4468
4469 107853
107854 4470
4471 107855
107856 4472
4473 107857
107858 4474
4475 107859
107860 4476
4477 107861
107862 4478
4479 107863
107864 4480
4481 107865
107866 4482
4483 107867
107868 4484
4485 1078...

result:

ok Operations: 100001

Test #136:

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

input:

abababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababab...

output:

100002
1 13939
13940 5289
105289 120496
71239 5290
54548 71240
71241 54549
54550 71242
71243 54551
54552 71244
71245 54553
54554 71246
71247 54555
54556 71248
71249 54557
54558 71250
71251 54559
54560 71252
71253 54561
54562 71254
71255 54563
54564 71256
71257 54565
54566 71258
71259 54567
54568 712...

result:

ok Operations: 100002

Test #137:

score: 25
Accepted
time: 15ms
memory: 18164kb

input:

babababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababa...

output:

150000
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: 150000

Test #138:

score: 25
Accepted
time: 15ms
memory: 17696kb

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: 23ms
memory: 15864kb

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: 20ms
memory: 17800kb

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: 15ms
memory: 17716kb

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 #142:

score: 25
Accepted
time: 19ms
memory: 17800kb

input:

abababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababab...

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 #143:

score: 25
Accepted
time: 15ms
memory: 17712kb

input:

abababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababab...

output:

199997
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: 199997

Test #144:

score: 25
Accepted
time: 7ms
memory: 14552kb

input:

aaabaaaababababbaabababbabaaaaaabbaabababbaabbbabaabaaaabbaabbbabbaaababbbaabbbbaabaabaaabaabaabaabababaaaabaaabaabbbbabbababbbabbaababababbabbaabbbbabaaababbbabbabaaaabbabaabaaaabbbababaaaabaababababbaabbbbababababaaabaabbbbabaaababbbababababbaaabaaaabaabbaababbaababbabbabbababababbababbbabbbbaaaaa...

output:

101948
3 3
4 6
10 8
9 12
13 10
11 15
16 12
13 17
18 15
17 19
21 18
19 22
23 26
27 25
26 28
30 28
29 31
32 31
37 33
35 41
43 36
37 44
45 38
39 47
48 40
42 49
51 46
49 54
55 50
51 56
58 52
53 62
66 54
56 68
70 57
60 71
72 62
64 75
78 65
66 80
81 69
72 85
87 74
78 89
91 79
80 92
94 81
82 95
98 85
86 10...

result:

ok Operations: 101948

Extra Test:

score: 0
Extra Test Passed