{ while(x<=n) { BIT[x]+=k; x+=lowbit(x); } } ll query(int x)//查询区间和 { ll res = 0; while (x!=0) { res+=BIT[x]; x-=lowbit(x); } return res; } public: long long countFairPairs(vector<int>& nums, int lower, int upper) { //离散化+树状数组 int m = nums...