CF1005E1 Median on Segments (Permutations Edition)
题目描述
#### 题目翻译
给定 $1\sim n$ 的排列 $(1\leq n\leq 2\times 10^5)$,求中位数为 $m$ 的子段个数(子段长度为偶数时,取其第 $\frac k 2$ 项,$k$ 为子段长度)
输入格式
第一行两个整数 $n, m$。
第二行长度为 $n$ 的排列。
输出格式
输出满足要求的方案数。
说明/提示
In the first example, the suitable pairs of indices are: $ (1, 3) $ , $ (2, 2) $ , $ (2, 3) $ and $ (2, 4) $ .