1688.
Kanade's sum
时间限制 2000 ms
内存限制 64 MB
Give you an array $A[1..n] $of length $n$.
Let $f(l,r,k)$ be the k-th largest element of $A[l..r]$.
Specially , $f(l,r,k)=0$ if $r-l+1
Give you $k$ , you need to calculate $\sum_{l=1}^{n}\sum_{r=l}^{n}f(l,r,k)$
There are T test cases.
$1\leq T\leq 10$
$k\leq min(n,80)$
$A[1..n] ~is~a~permutation~of~[1..n]$
$\sum n\leq 5*10^5$$.
输入数据
输出数据
For each test case,output an integer, which means the answer.
样例输入
复制
1
5 2
1 2 3 4 5
\n
\n
· \n
\n
· · · · \n