CF1100A Roman and Browser

题目描述

### 题目大意 给定一个长度为 $n$ 的只有 $1$ 和 $-1$ 的序列,选择一个位置 $b$,然后删掉位置为 $b+i\times k$ 的数($i$ 为整数),求操作后 $1$ 和 $-1$ 数量之差的绝对值的最大值。

输入格式

第一行两个整数 $n,k$。 第二行 $n$ 个整数,每个数是 $1$ 或 $-1$。

输出格式

一个整数,表示最大绝对差值。

说明/提示

In the first example we can choose $ b = 1 $ or $ b = 3 $ . We will delete then one tab of each type and the remaining tabs are then all contain test information. Thus, $ e = 2 $ and $ s = 0 $ and $ |e - s| = 2 $ . In the second example, on the contrary, we can leave opened only tabs that have social networks opened in them.