Problem Statement
There are $16$ integer tuples $(A, B, C, D)$ satisfying $A, B, C, D \in \lbrace 0, 1 \rbrace$. For each of them, solve the following problem.
A non-empty string
$S$consisting of0and1is called a beautiful string when it satisfies the following condition:
- (Condition) You can perform the following sequence of operations until the length of
$S$becomes$1$and make the only character remaining in$S$be1.- Choose any integer
$i$satisfying$1 \leq i \leq |S| - 1$.
- Define an integer
$x$as follows:- If
$S_i =$0and$S_{i+1} =$0, let$x = A$.
- If
$S_i =$0and$S_{i+1} =$1, let$x = B$.- If
$S_i =$1and$S_{i+1} =$0, let$x = C$.- If
$S_i =$1and$S_{i+1} =$1, let$x = D$.- Remove
$S_i$and$S_{i+1}$, and insert the digit corresponding to$x$in their place. For example, if$S=$10101and you choose$i=2$, the string after the operation is1001if$B=0$, and1101if$B=1$.You are given a string
$T$of length$N$consisting of0and1.
- Let
$L$be the length of the longest beautiful string that is a substring of$T$(if no substring of$T$is a beautiful string, let$L = -1$),- Let
$M$be the number of beautiful strings that are substrings of$T$.Find
$L$and$M$. Even if two substrings are identical as strings, count them separately if they are taken from different positions.
What are substrings? A substring of $S$ is a string obtained by deleting zero or more characters from the beginning and zero or more characters from the end of $S$. For example, 10 is a substring of 101, but 11 is not a substring of 101.
Constraints
$1 \leq N \leq 2 \times 10^5$$N$is an integer.$T$is a string of length$N$consisting of0and1.
Input
The input is given from Standard Input in the following format:
N
T
Output
Print $16$ lines. The $i$-th line should contain $L$ and $M$ separated by a space for $(A,B,C,D)$ satisfying $i-1 = 8A + 4B + 2C + D$.
样例
3
110
1 2
2 3
2 3
3 5
1 2
2 3
2 3
3 5
3 3
2 3
3 4
3 5
3 3
2 3
3 4
3 5
4
0000
-1 0
-1 0
-1 0
-1 0
-1 0
-1 0
-1 0
-1 0
4 4
4 4
4 6
4 6
4 6
4 6
4 6
4 6
30
011011100101110111100010011010
1 17
4 31
29 263
29 280
29 232
29 247
30 240
30 447
30 418
29 225
30 435
30 435
30 435
30 435
30 439
30 452
题面与样例版权归 AtCoder 及出题人所有;中文翻译由 AI 生成(CI 管线),如有出入请以原文为准。