摘要:
题目 Ultra-QuickSort 题解 这道题本质是求逆序对的个数,用归并思想来做。 参考代码 #include<iostream> using namespace std; typedef long long LL; const int N = 1e5 + 10; int n; int a[N 阅读全文
posted @ 2025-03-15 20:24
PZnwbh
阅读(5)
评论(0)
推荐(0)
摘要:
题目 Running Median 题解 这题考察的是堆的使用,但要想频繁得出堆中的中位数是极其不方便的,但是我们可以想到建两个堆,左边小的数放在大根堆中,右边大的数放在小根堆中,中位数为大根堆堆顶元素方便取出,每次放入考虑放在哪个堆中,如果堆不平衡只需要移动堆顶元素就行。 参考代码 #includ 阅读全文
posted @ 2025-03-15 16:00
PZnwbh
阅读(14)
评论(0)
推荐(0)

浙公网安备 33010602011771号