http://poj.org/problem?id=2299
//归并排序
#include<iostream>
#include<cstdio>
using namespace std;
int s[1000010],a[1000010],b[1000010];
__int64 cnt;
const int maxn=1000000000;
void merge(int l,int mid,int r)
{
int i,la=mid-l+1,lb=r-mid,j,k;
for(i=0;i<la;++i)
a[i]=s[i+l];
a[i]=maxn;
for(i=0;i<lb;++i)
b[i]=s[mid+1+i];
b[i]=maxn;
for(k=l,i=0,j=0;k<=r;++k)
if(a[i]<=b[j])//
s[k]=a[i++];
else
{
s[k]=b[j++];
cnt+=la-i;
}
}
void mergesort(int l,int r)
{
if(l<r)
{
int