摘要:
用归并排序求逆序对,用时391ms,但是用树状数组的话runtime error。#include <stdio.h> #include <string.h> const int N=500000;int a[N], b[N], n; __int64 Calc(int first, int last) { if (first == last-1) return 0; int mid = (first+last)/2, i = first, j = mid, k = first; __int64 res = Calc(first, mid)+Calc(mid, last) 阅读全文