CF1473C No More Inversions
题目描述
你有一个长度为 $n$ 的序列 $a$。$a=\{1,2,3,\dots,k-1,k,k-1,k-2,\dots,k-(n-k)\}(k\le na[j] (i
输入格式
无
输出格式
无
说明/提示
In the first test case, the sequence $ a = [1] $ , there is only one permutation $ p = [1] $ .
In the second test case, the sequence $ a = [1, 2] $ . There is no inversion in $ a $ , so there is only one permutation $ p = [1, 2] $ which doesn't increase the number of inversions.
In the third test case, $ a = [1, 2, 1] $ and has $ 1 $ inversion. If we use $ p = [2, 1] $ , then $ b = [p[a[1]], p[a[2]], p[a[3]]] = [2, 1, 2] $ and also has $ 1 $ inversion.
In the fourth test case, $ a = [1, 2, 3, 2] $ , and since $ p = [1, 3, 2] $ then $ b = [1, 3, 2, 3] $ . Both $ a $ and $ b $ have $ 1 $ inversion and $ b $ is the lexicographically maximum.