单点时限: 2.0 sec
内存限制: 512 MB
This question is similar to Move The Numbers.
A permutation of size
An inversion in a permutation
You are given a permutation
For example, if
After each query you have to answer the number of inversions.
There are multiple test cases in this problem.
In each test case,The first line contains two integers
The second line contains
The third line contains
For each testcase print
2 3 4 3 2 1 1 1 0 2 3 1 4 2 3 0 1 2
4 6 6 2 4 2