摘要: 参考:❀ 1 #include 2 #include 3 #include 4 #include 5 using namespace std; 6 const int MAXN=2500+50; 7 struct rec 8 { 9 int a,b;10 bool operator ... 阅读全文
posted @ 2015-07-16 20:08 iiyiyi 阅读(157) 评论(0) 推荐(0) 编辑
摘要: 【思路】建立一个小堆和一个大堆。大堆用来存放第1..index-1大的数,其余数存放在大堆,小堆的堆顶元素便是我们要求出的第index大的数。每次插入一个A(n),必须保证大堆中数字数目不变,故先插入小堆中。若此时小堆堆顶小于大堆堆顶,则交换堆顶元素;每次Get(),输出小堆的堆顶元素,并将它并入大... 阅读全文
posted @ 2015-07-16 10:19 iiyiyi 阅读(637) 评论(0) 推荐(0) 编辑