摘要:
终于写了个mergesort 偷懒不行啊#include <iostream>using namespace std;int a[500001];int temp[500001];__int64 sum;void merge(int l,int m,int r){ int p = 0; int i = l; int j = m+1; while(i<=m && j<=r) { if(a[i]>a[j]) { temp[p++] = a[j++]; sum += m-i+1; } else temp[p++] = a[i++]; } while(i& 阅读全文