md没见过这么垃圾的题面
请管理大大顺便把翻译中所有“置换”替换成“排列”
Latex:
You are given a permutation p of length n and a positive integer k.Consider a permutation q of length n such that for any integers i and j,where 1≤i<j≤n,we have
pqi≤pqj+k.
Find the minimum possible number of inversions in a permutation q.
A permutation is an array consisting of n distinct integers from 1 to n in arbitrary order.For example,[2,3,1,5,4] is a permutation,but [1,2,2] is not a permutation (2 appears twice in the array) and [1,3,4] is also not a permutation (n=3 but there is 4 in the array).
an inversion in a permutation a is a pair of indices i and j (1≤i,j≤n) such that i<j,but ai>aj
源代码
## 题目描述
You are given a permutation $p$ of length $n$ and a positive integer $k$.Consider a permutation $q$ of length $n$ such that for any integers $i$ and $j$,where $1 \le i < j \le n$,we have
$$p_{q_i}\le p_{q_j} + k.$$
Find the minimum possible number of inversions in a permutation $q$.
A permutation is an array consisting of $n$ distinct integers from $1$ to $n$ in arbitrary order.For example,$[2,3,1,5,4]$ is a permutation,but $[1,2,2]$ is not a permutation ($2$ appears twice in the array) and $[1,3,4]$ is also not a permutation ($n = 3$ but there is 4 in the array).
an inversion in a permutation $a$ is a pair of indices $i$ and $j$ ($1 \le i,j \le n$) such that $i<j$,but $a_i > a_j$