QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#378344#4273. Good Gamey0y683 57ms31932kbC++148.4kb2024-04-06 11:33:152024-04-06 11:33:15

Details

Tip: Click on the bar to expand more detailed information

Subtask #1:

score: 3
Accepted

Test #1:

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

input:

9
ABAABBBAA

output:

4
3 2
2 2
2 2
1 3

result:

ok good solution!

Test #2:

score: 0
Accepted
time: 0ms
memory: 3876kb

input:

13
ABABBABABBABA

output:

6
9 2
8 2
4 2
3 2
2 3
1 2

result:

ok good solution!

Test #3:

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

input:

15
AABABAABABAABAB

output:

7
1 2
9 2
8 2
4 2
3 2
2 3
1 2

result:

ok good solution!

Test #4:

score: 0
Accepted
time: 0ms
memory: 11628kb

input:

15
ABAABBBABAABBAB

output:

7
3 2
2 2
2 2
1 2
4 2
2 3
1 2

result:

ok good solution!

Test #5:

score: 0
Accepted
time: 0ms
memory: 3836kb

input:

1
B

output:

-1

result:

ok no solution

Test #6:

score: 0
Accepted
time: 1ms
memory: 5816kb

input:

2
BB

output:

1
1 2

result:

ok good solution!

Test #7:

score: 0
Accepted
time: 0ms
memory: 11708kb

input:

7
AAAABBB

output:

3
1 2
1 2
1 3

result:

ok good solution!

Test #8:

score: 0
Accepted
time: 0ms
memory: 13728kb

input:

11
BBBBBBAAAAA

output:

5
1 2
1 2
3 3
1 2
1 2

result:

ok good solution!

Test #9:

score: 0
Accepted
time: 0ms
memory: 13540kb

input:

2
AB

output:

-1

result:

ok no solution

Test #10:

score: 0
Accepted
time: 0ms
memory: 11500kb

input:

14
BAAAAAAAAAAAAA

output:

-1

result:

ok no solution

Test #11:

score: 0
Accepted
time: 0ms
memory: 13660kb

input:

14
ABBABAABBABBAB

output:

7
2 2
1 2
7 2
4 2
2 2
2 2
1 2

result:

ok good solution!

Test #12:

score: 0
Accepted
time: 1ms
memory: 3772kb

input:

15
BAABABABBABBAAB

output:

6
8 2
7 2
6 3
5 3
2 2
1 3

result:

ok good solution!

Test #13:

score: 0
Accepted
time: 0ms
memory: 5864kb

input:

14
BABBBBBBBBBBAB

output:

7
3 2
3 2
3 2
3 2
3 2
2 2
1 2

result:

ok good solution!

Test #14:

score: 0
Accepted
time: 1ms
memory: 5984kb

input:

15
BABAAAAAAAAABAB

output:

7
4 3
4 2
4 2
4 2
3 2
2 2
1 2

result:

ok good solution!

Test #15:

score: 0
Accepted
time: 2ms
memory: 13776kb

input:

14
BBBABAAAAAAABA

output:

6
6 3
6 2
1 3
3 2
2 2
1 2

result:

ok good solution!

Test #16:

score: 0
Accepted
time: 0ms
memory: 11764kb

input:

15
AAAABABAAAAABAB

output:

7
1 2
6 3
1 2
4 2
3 2
2 2
1 2

result:

ok good solution!

Test #17:

score: 0
Accepted
time: 1ms
memory: 3836kb

input:

14
BAAABABAAAABAB

output:

6
8 2
8 2
7 2
6 2
2 3
1 3

result:

ok good solution!

Test #18:

score: 0
Accepted
time: 0ms
memory: 3948kb

input:

15
ABAAAABABBBBABA

output:

7
3 2
7 2
7 2
6 2
3 2
2 3
1 2

result:

ok good solution!

Test #19:

score: 0
Accepted
time: 0ms
memory: 3928kb

input:

14
BABAAABAAAABAB

output:

6
8 2
8 2
4 3
3 3
2 2
1 2

result:

ok good solution!

Test #20:

score: 0
Accepted
time: 0ms
memory: 3916kb

input:

15
BABBABABBBBBBAB

output:

7
8 2
8 2
8 2
7 2
3 2
2 2
1 3

result:

ok good solution!

Test #21:

score: 0
Accepted
time: 0ms
memory: 5884kb

input:

14
BABAAAABABBBAB

output:

6
4 2
8 3
4 2
3 2
2 3
1 2

result:

ok good solution!

Test #22:

score: 0
Accepted
time: 1ms
memory: 5996kb

input:

15
BABAAAAAABABAAB

output:

7
4 2
4 2
9 2
4 2
3 2
2 2
1 3

result:

ok good solution!

Test #23:

score: 0
Accepted
time: 0ms
memory: 13800kb

input:

14
BABBBBBABAAAAA

output:

6
3 3
7 3
3 2
2 2
1 2
1 2

result:

ok good solution!

Test #24:

score: 0
Accepted
time: 0ms
memory: 11648kb

input:

15
BABAAAABABAAAAA

output:

7
4 2
9 3
4 2
3 2
2 2
1 2
1 2

result:

ok good solution!

Test #25:

score: 0
Accepted
time: 0ms
memory: 11624kb

input:

15
BAABABAABAABBAA

output:

7
2 2
1 2
6 2
3 2
2 2
2 2
1 3

result:

ok good solution!

Test #26:

score: 0
Accepted
time: 0ms
memory: 13764kb

input:

15
AABAABBAABAABAB

output:

7
1 2
9 2
6 2
4 2
4 2
2 3
1 2

result:

ok good solution!

Test #27:

score: 0
Accepted
time: 0ms
memory: 13620kb

input:

15
AABABBABAABBABB

output:

6
1 2
7 2
6 3
3 2
2 3
1 3

result:

ok good solution!

Test #28:

score: 0
Accepted
time: 0ms
memory: 13772kb

input:

15
BAABBABBAABABBA

output:

6
2 2
1 3
8 2
4 2
2 3
1 3

result:

ok good solution!

Test #29:

score: 0
Accepted
time: 0ms
memory: 13684kb

input:

15
BBAABBABABABBAA

output:

-1

result:

ok no solution

Test #30:

score: 0
Accepted
time: 0ms
memory: 13472kb

input:

15
ABABBAABBAABBAB

output:

-1

result:

ok no solution

Test #31:

score: 0
Accepted
time: 0ms
memory: 13808kb

input:

14
AAABAAAAABAAAB

output:

5
5 3
1 3
5 3
2 2
1 3

result:

ok good solution!

Test #32:

score: 0
Accepted
time: 0ms
memory: 11720kb

input:

15
ABBBBABBBBBABBB

output:

6
2 2
5 3
5 2
2 2
1 3
1 3

result:

ok good solution!

Test #33:

score: 0
Accepted
time: 2ms
memory: 13772kb

input:

14
BBBBABBABAAABA

output:

6
1 2
1 2
6 3
5 2
2 2
1 3

result:

ok good solution!

Test #34:

score: 0
Accepted
time: 0ms
memory: 11720kb

input:

15
AAAAABABBBABBAB

output:

6
1 3
1 2
7 2
3 3
2 3
1 2

result:

ok good solution!

Test #35:

score: 0
Accepted
time: 0ms
memory: 13628kb

input:

14
AABABBBBABAAAB

output:

6
5 2
1 2
7 3
3 2
2 2
1 3

result:

ok good solution!

Test #36:

score: 0
Accepted
time: 4ms
memory: 11712kb

input:

15
BAABAAAABABBBBA

output:

7
5 2
9 2
5 2
2 2
1 3
2 2
1 2

result:

ok good solution!

Test #37:

score: 0
Accepted
time: 0ms
memory: 11728kb

input:

14
ABBBABAAABAAAB

output:

5
2 3
1 2
6 3
2 3
1 3

result:

ok good solution!

Test #38:

score: 0
Accepted
time: 0ms
memory: 13660kb

input:

15
BAAABABBBBABAAA

output:

6
7 2
7 2
6 2
2 3
1 3
1 3

result:

ok good solution!

Test #39:

score: 0
Accepted
time: 2ms
memory: 13812kb

input:

14
BABBABBBBABAAA

output:

6
6 2
6 2
3 2
2 3
1 2
1 3

result:

ok good solution!

Test #40:

score: 0
Accepted
time: 0ms
memory: 11752kb

input:

15
ABAAABABBBABBBB

output:

6
12 2
8 3
3 3
2 2
1 3
1 2

result:

ok good solution!

Test #41:

score: 0
Accepted
time: 0ms
memory: 5736kb

input:

14
AABABABBAABBAA

output:

-1

result:

ok no solution

Test #42:

score: 0
Accepted
time: 0ms
memory: 3796kb

input:

15
AABBBABABAABBAA

output:

-1

result:

ok no solution

Test #43:

score: 0
Accepted
time: 1ms
memory: 3712kb

input:

14
AABBAABABABBAA

output:

-1

result:

ok no solution

Test #44:

score: 0
Accepted
time: 0ms
memory: 3716kb

input:

15
BBBAABBAABABABB

output:

-1

result:

ok no solution

Test #45:

score: 0
Accepted
time: 0ms
memory: 13680kb

input:

15
BABABBBBAABBAAA

output:

-1

result:

ok no solution

Test #46:

score: 0
Accepted
time: 0ms
memory: 13644kb

input:

15
BBBABABAABBBAAA

output:

-1

result:

ok no solution

Test #47:

score: 0
Accepted
time: 4ms
memory: 11660kb

input:

15
AAABBBBAABABABB

output:

-1

result:

ok no solution

Test #48:

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

input:

15
AAAAABBAABBABAB

output:

-1

result:

ok no solution

Test #49:

score: 0
Accepted
time: 0ms
memory: 13664kb

input:

15
BAAAABBAABBBABA

output:

-1

result:

ok no solution

Test #50:

score: 0
Accepted
time: 0ms
memory: 13720kb

input:

15
BABAAABBBAAABBA

output:

-1

result:

ok no solution

Subtask #2:

score: 0
Wrong Answer

Test #51:

score: 6
Accepted
time: 0ms
memory: 11460kb

input:

299
ABABABABABABABABABABABABABABABABABBAABBAABBAABBAAABBAABBAABBAABBAABBAABBAABBAABBAABBAABBAABBAABBAABBAABBAABBAABBAABBAABBAABBAABBAABBAABBAABBAABBAABBAABBAABBAABBAABBAABBAABBAABBAABBAABBAABBAABBAABBAABBBAABBAABBAABBAABBAABBAABBAABBAABBABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABA...

output:

-1

result:

ok no solution

Test #52:

score: 0
Accepted
time: 3ms
memory: 11608kb

input:

300
ABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABAABBAABBAABBAABBAABBAABBAABBAABBAAABBAABBAABBAABBAABBAABBAABBAABBBAABBAABBAABBAABBAABBAABBAABBAABBAABBAABBAABBAABBAABBAABBAABBAABBAABBAABBAABBAAABBAABBAABBAABBAABBAABBAABBAABBAABBAABBAABBAABBAABBAAB...

output:

-1

result:

ok no solution

Test #53:

score: 0
Accepted
time: 0ms
memory: 3960kb

input:

299
ABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABBBBBBBBABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABBBBBBABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABAB...

output:

149
96 2
96 2
96 2
193 2
193 2
193 2
192 2
191 2
190 2
189 2
188 2
187 2
186 2
185 2
184 2
183 2
182 2
181 2
180 2
179 2
178 2
177 2
176 2
175 2
174 2
173 2
172 2
171 2
170 2
169 2
168 2
167 2
166 2
165 2
164 2
163 2
162 2
161 2
160 2
159 2
158 2
157 2
156 2
155 2
154 2
153 2
152 2
151 2
150 2
149 2...

result:

ok good solution!

Test #54:

score: 0
Accepted
time: 0ms
memory: 11732kb

input:

299
BBBBBBABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABBBABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABBBBBABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABAB...

output:

148
1 2
1 2
196 3
1 2
194 2
193 2
192 2
191 2
190 2
189 2
188 2
187 2
186 2
185 2
184 2
183 2
182 2
181 2
180 2
179 2
178 2
177 2
176 2
175 2
174 2
173 2
172 2
171 2
170 2
169 2
168 2
167 2
166 2
165 2
164 2
163 2
162 2
161 2
160 2
159 2
158 2
157 2
156 2
155 2
154 2
153 2
152 2
151 2
150 2
149 2
14...

result:

ok good solution!

Test #55:

score: 0
Accepted
time: 4ms
memory: 13760kb

input:

297
BABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABAABBBABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABBAABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABA

output:

148
74 2
73 2
73 2
72 2
71 2
70 2
69 2
68 2
67 2
66 2
65 2
64 2
63 2
62 2
61 2
60 2
59 2
58 2
57 2
56 2
55 2
54 2
53 2
52 2
51 2
50 2
49 2
48 2
47 2
46 2
45 2
44 2
43 2
42 2
41 2
40 2
39 2
38 2
37 2
36 2
35 2
34 2
33 2
32 2
31 2
30 2
29 2
28 2
27 2
26 2
25 2
24 2
23 2
22 2
21 2
20 2
19 2
18 2
17 2
1...

result:

ok good solution!

Test #56:

score: 0
Accepted
time: 0ms
memory: 13804kb

input:

300
BABABABABABABABABABABABABABABABABABABABABABABABABABABABABAAAABBABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABBBAAABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABA...

output:

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

result:

ok good solution!

Test #57:

score: 0
Accepted
time: 4ms
memory: 13780kb

input:

299
ABABABABABABABABABABABABABABABABABABABABABABABABABABABABABAAABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABBBAABBBABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABA...

output:

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

result:

ok good solution!

Test #58:

score: 0
Accepted
time: 0ms
memory: 11588kb

input:

300
ABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABBABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABAAAABBAAAABABABABABABABABABABABABABABABABABABABABABAB...

output:

150
244 2
248 2
98 2
97 2
96 2
95 2
94 2
93 2
92 2
91 2
90 2
89 2
88 2
87 2
86 2
85 2
84 2
83 2
82 2
81 2
80 2
79 2
78 2
77 2
76 2
75 2
74 2
73 2
72 2
71 2
70 2
69 2
68 2
67 2
66 2
65 2
64 2
63 2
62 2
61 2
60 2
59 2
58 2
57 2
56 2
55 2
54 2
53 2
52 2
51 2
50 2
49 2
48 2
47 2
46 2
45 2
44 2
43 2
42 2...

result:

ok good solution!

Test #59:

score: 0
Accepted
time: 0ms
memory: 3772kb

input:

298
BBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBB

output:

149
1 2
1 2
1 2
1 2
1 2
1 2
1 2
1 2
1 2
1 2
1 2
1 2
1 2
1 2
1 2
1 2
1 2
1 2
1 2
1 2
1 2
1 2
1 2
1 2
1 2
1 2
1 2
1 2
1 2
1 2
1 2
1 2
1 2
1 2
1 2
1 2
1 2
1 2
1 2
1 2
1 2
1 2
1 2
1 2
1 2
1 2
1 2
1 2
1 2
1 2
1 2
1 2
1 2
1 2
1 2
1 2
1 2
1 2
1 2
1 2
1 2
1 2
1 2
1 2
1 2
1 2
1 2
1 2
1 2
1 2
1 2
1 2
1 2
1 2
...

result:

ok good solution!

Test #60:

score: 0
Accepted
time: 0ms
memory: 13676kb

input:

298
BAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA

output:

-1

result:

ok no solution

Test #61:

score: 0
Accepted
time: 0ms
memory: 11648kb

input:

297
BBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA

output:

148
1 3
1 2
1 2
1 2
1 2
1 2
1 2
1 2
1 2
1 2
1 2
1 2
1 2
1 2
1 2
1 2
1 2
1 2
1 2
1 2
1 2
1 2
1 2
1 2
1 2
1 2
1 2
1 2
1 2
1 2
1 2
1 2
1 2
1 2
1 2
1 2
1 2
1 2
1 2
1 2
1 2
1 2
1 2
1 2
1 2
1 2
1 2
1 2
1 2
1 2
1 2
1 2
1 2
1 2
1 2
1 2
1 2
1 2
1 2
1 2
1 2
1 2
1 2
1 2
1 2
1 2
1 2
1 2
1 2
1 2
1 2
1 2
1 2
3 2
...

result:

ok good solution!

Test #62:

score: 0
Accepted
time: 0ms
memory: 3840kb

input:

300
AAAABBBBAAAABBBBBBAABBAABBBBAAAAABBBBBAAAABBBBAAAABBBBBBAABBBAAAABBBBAAAABBBBBBAAAAABBAAABBAAABBBBBAAAABBBBAAABBBBAAAAAABBBBAABBAAAABBBBAAABBBBBAAABBBBBAAAABBAAABBBAABBBAAAABBBAAAAAABBBBBBAAABBAAAAAABBBBBAAAAAABBBBAAAAABBBBAAAABBBBBBAAABBBBAAAAAAABBAAAAAAABBBBBAAAABBBBAAAAABBBAAAAABBBAAAABBBBAAA...

output:

136
1 2
3 2
5 2
7 2
7 2
15 2
17 3
19 3
21 2
23 2
25 2
27 2
27 2
34 2
36 2
38 2
40 2
40 2
42 3
54 3
56 2
58 2
63 2
65 2
65 2
67 2
73 2
75 2
80 3
85 3
87 2
102 2
107 2
107 2
109 2
109 2
116 2
116 2
118 3
120 2
120 2
122 2
124 3
126 2
128 2
130 2
130 2
135 2
137 3
137 2
141 3
141 2
143 3
145 2
147 2
14...

result:

ok good solution!

Test #63:

score: -6
Wrong Answer
time: 1ms
memory: 3960kb

input:

299
BBBBBBBBBBBBABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABAAAAAAAAAABABABABABABABABABABABABABABABABABABABAAAAAAAAAAAAAAABABABABABABABABABABABABABABABABABABABABABABAAAAAAAAAAABABABABABABABABABABABABABABABABABABABABABBBBBBBABABABABABABABABABABABABABABABABABA...

output:

146
1 2
1 2
1 2
1 2
1 2
89 2
89 2
89 2
89 2
128 3
128 2
128 2
128 2
128 2
128 2
173 3
173 2
173 2
173 2
215 3
215 2
128 2
127 2
126 2
125 2
124 2
123 2
122 2
121 2
120 2
119 2
118 2
117 2
116 2
115 2
114 2
113 2
112 2
111 2
110 2
109 2
108 2
107 2
106 2
105 2
104 2
103 2
102 2
101 2
100 2
99 2
98 2
...

result:

wrong answer invalid operation on step #68: BA

Subtask #3:

score: 0
Wrong Answer

Test #102:

score: 7
Accepted
time: 1ms
memory: 3960kb

input:

5998
BABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABAB...

output:

2998
1996 2
3993 3
3993 2
3993 2
3993 2
3992 2
3991 2
3990 2
3989 2
3988 2
3987 2
3986 2
3985 2
3984 2
3983 2
3982 2
3981 2
3980 2
3979 2
3978 2
3977 2
3976 2
3975 2
3974 2
3973 2
3972 2
3971 2
3970 2
3969 2
3968 2
3967 2
3966 2
3965 2
3964 2
3963 2
3962 2
3961 2
3960 2
3959 2
3958 2
3957 2
3956 2
3...

result:

ok good solution!

Test #103:

score: 0
Accepted
time: 0ms
memory: 13804kb

input:

5999
BBBBBABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABAB...

output:

2998
1 3
1998 2
3995 3
1 2
3993 2
3992 2
3991 2
3990 2
3989 2
3988 2
3987 2
3986 2
3985 2
3984 2
3983 2
3982 2
3981 2
3980 2
3979 2
3978 2
3977 2
3976 2
3975 2
3974 2
3973 2
3972 2
3971 2
3970 2
3969 2
3968 2
3967 2
3966 2
3965 2
3964 2
3963 2
3962 2
3961 2
3960 2
3959 2
3958 2
3957 2
3956 2
3955 2
...

result:

ok good solution!

Test #104:

score: 0
Accepted
time: 3ms
memory: 11780kb

input:

5998
ABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABA...

output:

2998
1499 3
1498 3
1497 2
1496 2
1495 2
1494 2
1493 2
1492 2
1491 2
1490 2
1489 2
1488 2
1487 2
1486 2
1485 2
1484 2
1483 2
1482 2
1481 2
1480 2
1479 2
1478 2
1477 2
1476 2
1475 2
1474 2
1473 2
1472 2
1471 2
1470 2
1469 2
1468 2
1467 2
1466 2
1465 2
1464 2
1463 2
1462 2
1461 2
1460 2
1459 2
1458 2
1...

result:

ok good solution!

Test #105:

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

input:

5998
ABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABA...

output:

2999
1201 2
1198 2
1198 2
1197 2
1196 2
1195 2
1194 2
1193 2
1192 2
1191 2
1190 2
1189 2
1188 2
1187 2
1186 2
1185 2
1184 2
1183 2
1182 2
1181 2
1180 2
1179 2
1178 2
1177 2
1176 2
1175 2
1174 2
1173 2
1172 2
1171 2
1170 2
1169 2
1168 2
1167 2
1166 2
1165 2
1164 2
1163 2
1162 2
1161 2
1160 2
1159 2
1...

result:

ok good solution!

Test #106:

score: 0
Accepted
time: 0ms
memory: 13888kb

input:

5999
ABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABA...

output:

2999
4200 2
1199 2
1198 2
1197 2
1196 2
1195 2
1194 2
1193 2
1192 2
1191 2
1190 2
1189 2
1188 2
1187 2
1186 2
1185 2
1184 2
1183 2
1182 2
1181 2
1180 2
1179 2
1178 2
1177 2
1176 2
1175 2
1174 2
1173 2
1172 2
1171 2
1170 2
1169 2
1168 2
1167 2
1166 2
1165 2
1164 2
1163 2
1162 2
1161 2
1160 2
1159 2
1...

result:

ok good solution!

Test #107:

score: 0
Accepted
time: 2ms
memory: 13940kb

input:

5998
ABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABA...

output:

2998
1998 2
1997 2
1996 2
1995 2
1994 2
1993 2
1992 2
1991 2
1990 2
1989 2
1988 2
1987 2
1986 2
1985 2
1984 2
1983 2
1982 2
1981 2
1980 2
1979 2
1978 2
1977 2
1976 2
1975 2
1974 2
1973 2
1972 2
1971 2
1970 2
1969 2
1968 2
1967 2
1966 2
1965 2
1964 2
1963 2
1962 2
1961 2
1960 2
1959 2
1958 2
1957 2
1...

result:

ok good solution!

Test #108:

score: 0
Accepted
time: 1ms
memory: 3984kb

input:

5997
BBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBB...

output:

2998
1 3
1 2
1 2
1 2
1 2
1 2
1 2
1 2
1 2
1 2
1 2
1 2
1 2
1 2
1 2
1 2
1 2
1 2
1 2
1 2
1 2
1 2
1 2
1 2
1 2
1 2
1 2
1 2
1 2
1 2
1 2
1 2
1 2
1 2
1 2
1 2
1 2
1 2
1 2
1 2
1 2
1 2
1 2
1 2
1 2
1 2
1 2
1 2
1 2
1 2
1 2
1 2
1 2
1 2
1 2
1 2
1 2
1 2
1 2
1 2
1 2
1 2
1 2
1 2
1 2
1 2
1 2
1 2
1 2
1 2
1 2
1 2
1 2
1 2...

result:

ok good solution!

Test #109:

score: 0
Accepted
time: 0ms
memory: 11708kb

input:

6000
ABBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBB...

output:

-1

result:

ok no solution

Test #110:

score: 0
Accepted
time: 0ms
memory: 11752kb

input:

5999
BBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBB...

output:

2999
1 2
1 2
1 2
1 2
1 2
1 2
1 2
1 2
1 2
1 2
1 2
1 2
1 2
1 2
1 2
1 2
1 2
1 2
1 2
1 2
1 2
1 2
1 2
1 2
1 2
1 2
1 2
1 2
1 2
1 2
1 2
1 2
1 2
1 2
1 2
1 2
1 2
1 2
1 2
1 2
1 2
1 2
1 2
1 2
1 2
1 2
1 2
1 2
1 2
1 2
1 2
1 2
1 2
1 2
1 2
1 2
1 2
1 2
1 2
1 2
1 2
1 2
1 2
1 2
1 2
1 2
1 2
1 2
1 2
1 2
1 2
1 2
1 2
1 2...

result:

ok good solution!

Test #111:

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

input:

5999
BBBAAAABBAAAAAAABBBAAAAABBBBBAABBBAABBBBBAAAABBBBBAAAAABBBAAAAABBBBBAAAAAABBBBBAAAABBBBBBAAAAAAABBBBBBAAAABBBBBAAABBBAAABBBBAAAABBBBAAABBBAAAABBBBAAABBBBAAAABBAAAABBBAAAAAABBBAAABBBBBAAAAABBBBAAAABBBAAABBBAAABBAAAABBAAABBBBBAAAAAABBBBBBBAAAABBBAAABBBAABBBAAAABBAABBBBBBBAAAAAABBBBAAAAABBBBAAABBB...

output:

2632
4 2
8 3
8 2
13 3
15 3
24 3
26 2
28 3
30 3
35 3
37 3
39 2
39 2
41 3
43 2
45 2
45 2
47 3
47 2
49 2
49 2
51 2
53 3
64 2
66 2
68 2
76 2
78 2
83 2
85 2
89 2
94 2
94 2
102 3
104 3
106 2
108 2
124 2
131 3
133 2
133 2
135 3
135 2
137 2
153 2
159 3
159 2
161 2
161 2
163 2
165 3
167 2
175 2
177 3
192 2
1...

result:

ok good solution!

Test #112:

score: -7
Wrong Answer
time: 1ms
memory: 6136kb

input:

6000
BABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABAB...

output:

2996
1643 3
1643 2
1643 2
1643 2
1643 2
3339 2
3339 2
3339 2
3339 2
3339 2
3339 2
3339 2
3533 3
3533 2
3533 2
3703 3
3703 2
3703 2
3703 2
5147 3
5147 2
3339 2
3338 2
3337 2
3336 2
3335 2
3334 2
3333 2
3332 2
3331 2
3330 2
3329 2
3328 2
3327 2
3326 2
3325 2
3324 2
3323 2
3322 2
3321 2
3320 2
3319 2
3...

result:

wrong answer invalid operation on step #2191: AB

Subtask #4:

score: 0
Wrong Answer

Test #153:

score: 9
Accepted
time: 37ms
memory: 24120kb

input:

999997
ABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABA...

output:

499998
333328 2
333328 2
666657 2
666657 2
666657 2
666657 2
666657 2
666656 2
666655 2
666654 2
666653 2
666652 2
666651 2
666650 2
666649 2
666648 2
666647 2
666646 2
666645 2
666644 2
666643 2
666642 2
666641 2
666640 2
666639 2
666638 2
666637 2
666636 2
666635 2
666634 2
666633 2
666632 2
66663...

result:

ok good solution!

Test #154:

score: 0
Accepted
time: 52ms
memory: 31932kb

input:

999998
BBBBBBABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABA...

output:

499998
1 2
1 2
333330 2
333330 2
666659 3
1 2
666657 2
666656 2
666655 2
666654 2
666653 2
666652 2
666651 2
666650 2
666649 2
666648 2
666647 2
666646 2
666645 2
666644 2
666643 2
666642 2
666641 2
666640 2
666639 2
666638 2
666637 2
666636 2
666635 2
666634 2
666633 2
666632 2
666631 2
666630 2
66...

result:

ok good solution!

Test #155:

score: 0
Accepted
time: 48ms
memory: 31544kb

input:

999997
BABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABAB...

output:

499998
249999 2
249998 2
249998 2
249997 2
249996 2
249995 2
249994 2
249993 2
249992 2
249991 2
249990 2
249989 2
249988 2
249987 2
249986 2
249985 2
249984 2
249983 2
249982 2
249981 2
249980 2
249979 2
249978 2
249977 2
249976 2
249975 2
249974 2
249973 2
249972 2
249971 2
249970 2
249969 2
24996...

result:

ok good solution!

Test #156:

score: 0
Accepted
time: 34ms
memory: 31648kb

input:

999998
ABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABA...

output:

499998
200001 2
199998 2
199998 2
199997 2
199996 2
199995 2
199994 2
199993 2
199992 2
199991 2
199990 2
199989 2
199988 2
199987 2
199986 2
199985 2
199984 2
199983 2
199982 2
199981 2
199980 2
199979 2
199978 2
199977 2
199976 2
199975 2
199974 2
199973 2
199972 2
199971 2
199970 2
199969 2
19996...

result:

ok good solution!

Test #157:

score: 0
Accepted
time: 57ms
memory: 31472kb

input:

999999
BABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABAB...

output:

499999
199999 2
199999 2
199998 2
199997 2
199996 2
199995 2
199994 2
199993 2
199992 2
199991 2
199990 2
199989 2
199988 2
199987 2
199986 2
199985 2
199984 2
199983 2
199982 2
199981 2
199980 2
199979 2
199978 2
199977 2
199976 2
199975 2
199974 2
199973 2
199972 2
199971 2
199970 2
199969 2
19996...

result:

ok good solution!

Test #158:

score: 0
Accepted
time: 52ms
memory: 31660kb

input:

999997
BABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABAB...

output:

499998
333331 2
333330 2
333329 2
333328 2
333327 2
333326 2
333325 2
333324 2
333323 2
333322 2
333321 2
333320 2
333319 2
333318 2
333317 2
333316 2
333315 2
333314 2
333313 2
333312 2
333311 2
333310 2
333309 2
333308 2
333307 2
333306 2
333305 2
333304 2
333303 2
333302 2
333301 2
333300 2
33329...

result:

ok good solution!

Test #159:

score: 0
Accepted
time: 37ms
memory: 10240kb

input:

999999
BBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBB...

output:

499999
1 3
1 2
1 2
1 2
1 2
1 2
1 2
1 2
1 2
1 2
1 2
1 2
1 2
1 2
1 2
1 2
1 2
1 2
1 2
1 2
1 2
1 2
1 2
1 2
1 2
1 2
1 2
1 2
1 2
1 2
1 2
1 2
1 2
1 2
1 2
1 2
1 2
1 2
1 2
1 2
1 2
1 2
1 2
1 2
1 2
1 2
1 2
1 2
1 2
1 2
1 2
1 2
1 2
1 2
1 2
1 2
1 2
1 2
1 2
1 2
1 2
1 2
1 2
1 2
1 2
1 2
1 2
1 2
1 2
1 2
1 2
1 2
1 2
1...

result:

ok good solution!

Test #160:

score: 0
Accepted
time: 12ms
memory: 15900kb

input:

999998
BAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA...

output:

-1

result:

ok no solution

Test #161:

score: 0
Accepted
time: 31ms
memory: 16084kb

input:

999998
BBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBB...

output:

499999
1 2
1 2
1 2
1 2
1 2
1 2
1 2
1 2
1 2
1 2
1 2
1 2
1 2
1 2
1 2
1 2
1 2
1 2
1 2
1 2
1 2
1 2
1 2
1 2
1 2
1 2
1 2
1 2
1 2
1 2
1 2
1 2
1 2
1 2
1 2
1 2
1 2
1 2
1 2
1 2
1 2
1 2
1 2
1 2
1 2
1 2
1 2
1 2
1 2
1 2
1 2
1 2
1 2
1 2
1 2
1 2
1 2
1 2
1 2
1 2
1 2
1 2
1 2
1 2
1 2
1 2
1 2
1 2
1 2
1 2
1 2
1 2
1 2
1...

result:

ok good solution!

Test #162:

score: 0
Accepted
time: 25ms
memory: 21212kb

input:

999998
AAAAAAAABBBBAAAAAABBAAAABBBAAAAAABBBBBBAAAAABBBBBBAAAABBBAAABBBAAAAAABBBAAABBBBBAABBBBBBAAABBAAAAAAABBBAAAAAAABBBAAAAAABBBBAAABBBAAABBBBBBAAAABBBAAABBBAAAABBBBAABBBBAAAAABBBBBBAAAAAABBBBBAABBBBBBAAABBBBAABBAAAABBAABBBBAABBBBBBAAAAABBBBBBAAAAABBBBAAAAABBAAAAAAAABBAAAABBBBAAABBBBAAAABBBBBAAAABB...

output:

438677
1 2
1 2
1 2
3 2
5 2
5 2
9 2
14 2
14 2
16 2
16 2
18 3
20 2
20 2
22 2
33 2
33 2
41 3
45 2
45 2
52 3
52 2
57 3
57 2
62 2
62 2
64 2
75 2
75 2
77 2
88 2
90 2
94 2
96 3
98 2
98 2
100 2
100 2
102 3
106 2
106 2
111 2
117 2
123 2
127 2
127 2
129 3
131 2
131 2
133 3
135 2
137 3
141 2
141 2
141 2
145 2
...

result:

ok good solution!

Test #163:

score: 0
Accepted
time: 8ms
memory: 16492kb

input:

999997
BABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABAB...

output:

-1

result:

ok no solution

Test #164:

score: 0
Accepted
time: 45ms
memory: 31640kb

input:

1000000
BABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABA...

output:

499998
88574 3
88574 2
88574 2
88574 2
180786 2
180786 2
297011 2
297011 2
297011 2
297011 2
297011 2
780002 2
780002 2
780002 2
780002 2
780002 2
780002 2
827619 2
827619 2
827619 2
827619 2
827619 2
297011 2
297010 2
297009 2
297008 2
297007 2
297006 2
297005 2
297004 2
297003 2
297002 2
297001 2
...

result:

ok good solution!

Test #165:

score: -9
Wrong Answer
time: 48ms
memory: 23980kb

input:

999997
BABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABAB...

output:

499993
80031 2
128875 3
277676 2
277676 2
555058 3
555058 2
555058 2
589040 2
589040 2
614084 2
614084 2
755194 3
842630 3
842630 2
842630 2
842630 2
555058 2
555057 2
555056 2
555055 2
555054 2
555053 2
555052 2
555051 2
555050 2
555049 2
555048 2
555047 2
555046 2
555045 2
555044 2
555043 2
555042...

result:

wrong answer invalid operation on step #342664: AB