看到大家都是使用归并排序,我这里就加上树状数组的写法吧。这里没有细节考虑值相同的问题(虽然题目中指明不会出现重复的数) class Solution { public: long long ans = 0; int n; int C[200005] = {0}; struct point{ int val,pos; } a[200005]; int lowbit(int x){ return x&(-x); } static bool cmp(point x,point y){ return x.val < y.val; } void add(int x){ while(x &l...