QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#517066#325. AB-Strings2_qiym100 ✓32ms13856kbC++175.8kb2024-08-13 05:01:242024-08-13 05:01:24

Judging History

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

  • [2024-08-13 05:01:24]
  • 评测
  • 测评结果:100
  • 用时:32ms
  • 内存:13856kb
  • [2024-08-13 05:01:24]
  • 提交

answer

#include "bits/extc++.h"

using namespace std;

using ll = long long;

template <typename T, typename... U>
void dbgh(const T& t, const U&... u) {
    cerr << t;
    ((cerr << " | " << u), ...);
    cerr << endl;
}

#ifdef DEBUG
#define dbg(...)                                              \
    cerr << "L" << __LINE__ << " [" << #__VA_ARGS__ << "]: "; \
    dbgh(__VA_ARGS__)
#else
#define dbg(...)
#define cerr   \
    if (false) \
    cerr
#endif

#define sz(x) int(std::size(x))

void solve() {
    string a, b;
    cin >> a >> b;
    string ca = a, cb = b;
    vector<int> spa, spb;
    int swa = 1, swb = 1;
    deque<int> sa, sb;
    for (int i = 0; i < sz(a); i++) {
        sa.push_back(a[i]);
    }
    for (int i = 0; i < sz(b); i++) {
        sb.push_back(b[i]);
    }
    for (int i = 1; i < sz(a); i++) {
        if (a[i] != a[i - 1]) {
            swa++;
            spa.push_back(i);
        }
    }
    spa.push_back(sz(a));
    for (int i = 1; i < sz(b); i++) {
        if (b[i] != b[i - 1]) {
            swb++;
            spb.push_back(i);
        }
    }
    spb.push_back(sz(b));
    vector<pair<int, int>> moves;
    while (a[0] == b[0]) {
        int change = abs(swa - swb) / 2;
        change += (1 - change % 2);
        if (swa > swb) {
            if ((swa - swb) % 4 == 3) {
                moves.push_back({spa[change], spb[0]});
            } else {
                moves.push_back({spa[change - 1], 0});
            }
        } else {
            if ((swb - swa) % 4 == 3) {
                moves.push_back({spa[0], spb[change]});
            } else {
                moves.push_back({0, spb[change - 1]});
            }
        }
        string c = a, d = b;
        a = "", b = "";
        for (int i = 0; i < moves.back().second; i++) {
            a += d[i];
        }
        for (int i = moves.back().first; i < sz(c); i++) {
            a += c[i];
        }
        for (int i = 0; i < moves.back().first; i++) {
            b += c[i];
        }
        for (int i = moves.back().second; i < sz(d); i++) {
            b += d[i];
        }
        swa = 1, swb = 1;
        spa.clear();
        spb.clear();
        for (int i = 0; i < sz(a); i++) {
            sa.push_back(a[i]);
        }
        for (int i = 0; i < sz(b); i++) {
            sb.push_back(b[i]);
        }
        for (int i = 1; i < sz(a); i++) {
            if (a[i] != a[i - 1]) {
                swa++;
                spa.push_back(i);
            }
        }
        spa.push_back(sz(a));
        for (int i = 1; i < sz(b); i++) {
            if (b[i] != b[i - 1]) {
                swb++;
                spb.push_back(i);
            }
        }
        spb.push_back(sz(b));
    }
    dbg(swa, swb, a, b);
    if (abs(swa - swb) > 1) {
        int change = abs(swa - swb) / 2;
        change += (1 - change % 2);
        dbg(swa, swb, change);
        if (swa - swb > 0) {
            if ((swa - swb) % 4 == 0) {
                moves.push_back({spa[change - 1], spb[0]});
            }
            if ((swa - swb) % 4 == 1) {
                moves.push_back({spa[change - 1], spb[0]});
            }
            if ((swa - swb) % 4 == 2) {
                moves.push_back({spa[change - 1], 0});
            }
            if ((swa - swb) % 4 == 3) {
                if (swb == 1) {
                    moves.push_back({spa[change - 1], 0});
                } else {
                    moves.push_back({spa[change + 1], spb[0]});
                }
            }
        } else {
            if ((swb - swa) % 4 == 0) {
                moves.push_back({spa[0], spb[change - 1]});
            }
            if ((swb - swa) % 4 == 1) {
                moves.push_back({spa[0], spb[change - 1]});
            }
            if ((swb - swa) % 4 == 2) {
                moves.push_back({0, spb[change - 1]});
            }
            if ((swb - swa) % 4 == 3) {
                if (swa == 1) {
                    moves.push_back({0, spb[change - 1]});
                } else {
                    moves.push_back({spa[0], spb[change + 1]});
                }
            }
        }
        string c = a, d = b;
        a = "", b = "";
        for (int i = 0; i < moves.back().second; i++) {
            a += d[i];
        }
        for (int i = moves.back().first; i < sz(c); i++) {
            a += c[i];
        }
        for (int i = 0; i < moves.back().first; i++) {
            b += c[i];
        }
        for (int i = moves.back().second; i < sz(d); i++) {
            b += d[i];
        }
        swa = 1, swb = 1;
        spa.clear();
        spb.clear();
        for (int i = 0; i < sz(a); i++) {
            sa.push_back(a[i]);
        }
        for (int i = 0; i < sz(b); i++) {
            sb.push_back(b[i]);
        }
        for (int i = 1; i < sz(a); i++) {
            if (a[i] != a[i - 1]) {
                swa++;
                spa.push_back(i);
            }
        }
        spa.push_back(sz(a));
        for (int i = 1; i < sz(b); i++) {
            if (b[i] != b[i - 1]) {
                swb++;
                spb.push_back(i);
            }
        }
        spb.push_back(sz(b));
    }
    dbg(swa, swb, a, b);
    int offa = 0, offb = 0, idx = 0;
    while (max(swa, swb) != 1) {
        int atb = spa[idx] - offa + offb, bta = spb[idx] - offb + offa;
        moves.push_back({atb, bta});
        offa += atb;
        offb += bta;
        idx++;
        swa--;
        swb--;
    }
    cout << moves.size() << "\n";
    for (auto [aa, bb] : moves) {
        cout << aa << " " << bb << "\n";
    }
}

int main() {
    cin.tie(nullptr);
    cin.exceptions(ios::failbit);
    ios_base::sync_with_stdio(false);
    int t = 1;
    while (t--) {
        solve();
    }
}

詳細信息

Subtask #1:

score: 5
Accepted

Test #1:

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

input:

a
b

output:

0

result:

ok Operations: 0

Test #2:

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

input:

b
a

output:

0

result:

ok Operations: 0

Test #3:

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

input:

a
bb

output:

0

result:

ok Operations: 0

Test #4:

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

input:

b
ab

output:

1
1 1

result:

ok Operations: 1

Test #5:

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

input:

b
ba

output:

1
0 1

result:

ok Operations: 1

Test #6:

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

input:

ab
bb

output:

1
1 2

result:

ok Operations: 1

Test #7:

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

input:

ba
bb

output:

1
1 0

result:

ok Operations: 1

Test #8:

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

input:

bab
bbb

output:

2
1 0
1 4

result:

ok Operations: 2

Test #9:

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

input:

abb
bbb

output:

1
1 3

result:

ok Operations: 1

Test #10:

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

input:

a
bbbb

output:

0

result:

ok Operations: 0

Test #11:

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

input:

abbb
b

output:

1
1 1

result:

ok Operations: 1

Test #12:

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

input:

b
bbba

output:

1
0 3

result:

ok Operations: 1

Test #13:

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

input:

bbb
abbbb

output:

1
3 1

result:

ok Operations: 1

Test #14:

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

input:

bbbbba
bbbb

output:

1
5 0

result:

ok Operations: 1

Test #15:

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

input:

abbbbb
bbbbbb

output:

1
1 6

result:

ok Operations: 1

Test #16:

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

input:

bbbbba
bbbbbb

output:

1
5 0

result:

ok Operations: 1

Test #17:

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

input:

bbbbbb
bbbbba

output:

1
0 5

result:

ok Operations: 1

Test #18:

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

input:

bbabbb
bbbbbb

output:

2
2 0
1 8

result:

ok Operations: 2

Test #19:

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

input:

bbbbbb
bbbabb

output:

2
0 3
9 1

result:

ok Operations: 2

Subtask #2:

score: 10
Accepted

Dependency #1:

100%
Accepted

Test #20:

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

input:

aaaaaa
bbbbbb

output:

0

result:

ok Operations: 0

Test #21:

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

input:

aaaaaa
aaaabb

output:

1
0 4

result:

ok Operations: 1

Test #22:

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

input:

aaaaba
aaaaaa

output:

2
4 0
1 10

result:

ok Operations: 2

Test #23:

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

input:

bbabba
bbbbbb

output:

3
3 6
0 2
10 1

result:

ok Operations: 3

Test #24:

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

input:

bbabab
bbbbbb

output:

3
4 0
1 2
3 2

result:

ok Operations: 3

Test #25:

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

input:

bbbbbb
bababa

output:

3
0 3
1 1
2 2

result:

ok Operations: 3

Test #26:

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

input:

bbbbba
bbbba

output:

2
0 4
9 1

result:

ok Operations: 2

Test #27:

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

input:

aaaaba
aaabbb

output:

2
4 0
1 7

result:

ok Operations: 2

Test #28:

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

input:

bbbbba
baaaba

output:

3
0 1
6 3
4 7

result:

ok Operations: 3

Test #29:

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

input:

baabab
bbbbaa

output:

3
3 4
5 0
1 6

result:

ok Operations: 3

Test #30:

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

input:

bababa
bbbaaa

output:

4
3 0
1 1
2 2
3 6

result:

ok Operations: 4

Test #31:

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

input:

abbbba
aaaaba

output:

3
0 4
5 1
5 6

result:

ok Operations: 3

Test #32:

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

input:

abbaa
abbabb

output:

3
0 1
2 2
4 3

result:

ok Operations: 3

Test #33:

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

input:

baabab
bbbabb

output:

4
1 0
2 4
5 3
4 7

result:

ok Operations: 4

Test #34:

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

input:

bababa
bbbabb

output:

4
2 3
4 0
1 5
6 3

result:

ok Operations: 4

Test #35:

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

input:

baabaa
baabaa

output:

4
0 1
2 2
4 3
4 6

result:

ok Operations: 4

Test #36:

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

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

input:

bababa
bbabaa

output:

5
1 0
1 3
4 2
3 5
6 5

result:

ok Operations: 5

Test #38:

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

input:

babaab
bbabab

output:

5
0 2
3 1
2 4
5 3
5 6

result:

ok Operations: 5

Test #39:

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

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

input:

bababa
bababa

output:

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

result:

ok Operations: 6

Test #41:

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

input:

bbbbba
aaaaaa

output:

1
5 6

result:

ok Operations: 1

Test #42:

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

input:

aabaaa
bbbbbb

output:

2
2 0
1 2

result:

ok Operations: 2

Test #43:

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

input:

bbabba
aaaaaa

output:

3
2 0
1 2
4 7

result:

ok Operations: 3

Test #44:

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

input:

abbaba
bbbbbb

output:

3
4 6
7 1
2 9

result:

ok Operations: 3

Test #45:

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

input:

bbbbbb
ababab

output:

3
6 3
1 7
8 2

result:

ok Operations: 3

Test #46:

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

input:

bbbaa
aaaabb

output:

1
3 4

result:

ok Operations: 1

Test #47:

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

input:

bbbbba
aabaaa

output:

2
5 2
3 6

result:

ok Operations: 2

Test #48:

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

input:

bbaaaa
aababb

output:

3
0 2
2 1
3 3

result:

ok Operations: 3

Test #49:

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

input:

bbbbaa
abbaba

output:

3
4 4
1 5
7 2

result:

ok Operations: 3

Test #50:

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

input:

bababa
aaaabb

output:

3
3 4
5 1
2 6

result:

ok Operations: 3

Test #51:

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

input:

bbaaab
abaaaa

output:

2
2 1
4 3

result:

ok Operations: 2

Test #52:

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

input:

baabaa
aabba

output:

3
1 2
4 3
4 5

result:

ok Operations: 3

Test #53:

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

input:

babbab
abbbaa

output:

4
1 0
1 1
3 2
3 6

result:

ok Operations: 4

Test #54:

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

input:

aaabba
bababa

output:

4
3 3
1 4
5 2
5 6

result:

ok Operations: 4

Test #55:

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

input:

aabbab
baaaba

output:

3
2 1
3 5
6 4

result:

ok Operations: 3

Test #56:

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

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

input:

bbabba
ababab

output:

5
0 1
1 1
3 2
3 4
6 4

result:

ok Operations: 5

Test #58:

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

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

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

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

input:

bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa

output:

0

result:

ok Operations: 0

Test #62:

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

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

input:

aaaaaaaaaaaaaaaaaaabbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb
ababababababababababababababababababababababababab

output:

26
0 25
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
44 25

result:

ok Operations: 26

Test #64:

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

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

input:

bababababababababababababababababababababababababa
bbbbbbbbbbbbbbbbbbbaaaaaaaaabbbbbbbbbbbbbbbbbbbbaa

output:

27
23 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 42
43 32
33 63
64 35

result:

ok Operations: 27

Test #66:

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

input:

ababababababababababababababababababababababababa
aabbbabbbbabbbaabbbabbaabaaaaabaaabaabaababbaaba

output:

37
13 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 15
16 16
17 17
18 21
22 19
20 25
26 22
23 29
30 24
25 32
33 27
28 34
35 33
34 36
37 37
38 38
39 40
41 40
41 43
44 42
43 45
46 45
46 48
49 47

result:

ok Operations: 37

Test #67:

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

input:

bababababababababababababababababababababababababa
bababababababababababababababababababababababababa

output:

50
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

result:

ok Operations: 50

Test #68:

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

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

input:

ababababababababababababababbababababababababababa
abababababababababababababababababaabababababababa

output:

49
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
29 29
30 30
31 31
32 32
33 33
34 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: 49

Test #70:

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

input:

abababababababababababababaabababababababbabababab
ababababababababababababababababababababababababab

output:

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

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

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

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

input:

bababababababababababababababababababababababababa
aaabbbbbbbbbbbbbbbbbbbbbbbbbbbaaaaaaaaaaaaaaabbbbb

output:

27
23 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 26
27 51
52 42

result:

ok Operations: 27

Test #75:

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

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

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

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

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

input:

bababababababababababababababababababababababababa
aabababababababababababababababababababababababaab

output:

49
1 0
1 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: 0ms
memory: 3560kb

input:

aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb...

output:

0

result:

ok Operations: 0

Test #81:

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

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

input:

aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaabbb
ababababababababababababababababababababababababa...

output:

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

Test #83:

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

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

input:

bababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababa
bbbbbbbbbbaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa...

output:

127
123 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
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: 127

Test #85:

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

input:

ababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababab
ababababababababababababababababababababababababa...

output:

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

Test #86:

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

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

input:

abababababababababababababababababababababababababababababababababababababababababaabababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababa
ababababababababababababababababababababababababa...

output:

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

Test #88:

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

input:

bababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababaabababababababababababababababababababababababababa
bababaabaaaaabababbaababbbbbbabbabbabbbbbabbaaabba...

output:

199
49 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
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 50
51 50
51 52
53 ...

result:

ok Operations: 199

Test #89:

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

input:

abababababaabbaaabababababababbbaaababaaabbaababaababaabababaabaababbabababaababaabababababaabbabaabaabbabababbabbaaabaabababababababaababbaabaababbbabababaaabaabaabbababababbabaabaababbabbaababababaabbababaaabbaababaabaababababababbaabaabababbababba
aaaaaaaaaaaabbbaaabaaaaabbbbbbbbbbbaaaaaaaaaaabbb...

output:

111
105 0
1 1
2 2
3 3
4 4
6 5
6 7
9 7
10 10
11 11
13 12
13 15
16 15
16 19
20 17
18 21
22 19
20 23
24 21
22 25
26 23
24 27
28 25
26 29
31 27
28 32
33 31
33 36
38 34
35 39
41 36
37 44
45 39
42 47
48 43
44 49
50 45
46 52
53 47
48 54
57 49
50 59
61 51
52 62
64 53
55 65
66 56
57 68
69 58
59 71
72 60
61 7...

result:

ok Operations: 111

Test #90:

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

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

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

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

input:

bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaabbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
ababababababababababababababababababababababababa...

output:

127
0 123
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: 127

Test #94:

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

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

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

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

input:

ababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababbabababababababab
bababbaababbbababababaabaabbbbabbaaaababbbababaaab...

output:

199
49 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
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: 0ms
memory: 3828kb

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

input:

aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa...

output:

0

result:

ok Operations: 0

Test #100:

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

input:

bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb...

output:

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

result:

ok Operations: 1001

Test #101:

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

input:

abababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababab...

output:

1001
999 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
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 #102:

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

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

input:

bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa...

output:

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

Test #104:

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

input:

abababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababab...

output:

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

Test #105:

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

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

input:

babababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababa...

output:

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

Test #107:

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

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

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

input:

abababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababab...

output:

1001
999 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
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 #110:

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

input:

babababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababa...

output:

1001
999 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
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 #111:

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

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

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

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

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

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

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

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

input:

bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb...

output:

0

result:

ok Operations: 0

Test #119:

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

input:

aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa...

output:

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

result:

ok Operations: 100001

Test #120:

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

input:

abababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababab...

output:

100001
99999 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
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 #121:

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

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: 17ms
memory: 10628kb

input:

babababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababa...

output:

100002
99999 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
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: 100002

Test #123:

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

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

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: 24ms
memory: 11892kb

input:

babababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababa...

output:

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

result:

ok Operations: 200000

Test #126:

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

input:

abababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababab...

output:

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

result:

ok Operations: 199999

Test #127:

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

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: 17ms
memory: 11824kb

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

score: 25
Accepted
time: 32ms
memory: 13856kb

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

input:

abababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababab...

output:

199998
3 0
1 1
2 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: 199998

Test #131:

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

input:

aaababbaabbbbaababababababbbabbaaaababbabababbabaabbbabbabbbbabaaabbbaaabbababbaabbbaabbbababbaabbabaababbbaaaabbbababbbabbabaaaabbbababababaababaababbaabbbbbbabbaaabbbaaaababababaaabbbabbbaabaabbabaabababaaabaaabaaabababaabababbbaaababaaabaabbbbababaababbababbabaabbbaababababbbababaabbababbbabbbbaa...

output:

101948
32114 0
3 3
4 4
5 5
6 7
8 8
10 12
13 12
13 14
15 14
15 16
18 16
17 19
21 18
20 22
23 21
22 24
25 23
27 28
29 28
32 31
32 36
38 33
35 39
40 37
38 41
42 39
41 43
48 42
43 49
50 45
48 51
53 49
52 55
56 55
56 57
58 58
59 59
60 63
64 61
62 65
66 65
67 69
70 70
72 72
73 73
74 74
75 75
79 77
80 81
8...

result:

ok Operations: 101948

Test #132:

score: 25
Accepted
time: 8ms
memory: 10608kb

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

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

input:

abababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababab...

output:

100001
99999 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
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 #134:

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

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: 10ms
memory: 10536kb

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: 10ms
memory: 10704kb

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: 17ms
memory: 10788kb

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: 18ms
memory: 9248kb

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: 18ms
memory: 9356kb

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: 25ms
memory: 9256kb

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: 29ms
memory: 11920kb

input:

abababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababab...

output:

199999
1 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
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: 21ms
memory: 11760kb

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

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

input:

aaabaaaababababbaabababbabaaaaaabbaabababbaabbbabaabaaaabbaabbbabbaaababbbaabbbbaabaabaaabaabaabaabababaaaabaaabaabbbbabbababbbabbaababababbabbaabbbbabaaababbbabbabaaaabbabaabaaaabbbababaaaabaababababbaabbbbababababaaabaabbbbabaaababbbababababbaaabaaaabaabbaababbaababbabbabbababababbababbbabbbbaaaaa...

output:

101948
32038 0
1 3
4 2
3 8
9 4
6 10
11 7
8 12
13 9
11 14
15 13
14 17
19 15
16 20
22 17
18 23
31 20
21 32
33 22
25 39
42 27
28 44
45 29
31 46
48 32
35 49
52 37
38 54
56 41
42 57
58 43
49 60
62 50
52 66
67 54
55 69
70 58
59 71
74 61
63 77
78 64
65 79
80 68
70 82
83 74
76 85
86 77
79 88
89 80
81 92
93 ...

result:

ok Operations: 101948

Extra Test:

score: 0
Extra Test Passed