求逆序对
Description
给定一个序列a1,a2,…,an,如果存在i<j并且ai>aj,那么我们称之为逆序对,求逆序对的数目。 Input
第一行为n,表示序列长度,接下来的一行包含n个整数(A1,A2,…,An),表示序列中的n个数。
N<=105,Ai<=1055,Ai<=105
Output
输出所有逆序对总数。
Sample Input
4
3 2 3 2
Sample Output
3
#include<bits/stdc++.h>
using namespace std;
const int INF=0x3f3f3f3f;
typedef long long ll;
ll merge_count(vector<int> &a){
int n=a.size();
if(n<=