洛谷P1177快速排序

#include<bits/stdc++.h>
using namespace std;
const int maxx = 100000 + 10;
int Heap[maxx];
int main() {
int n,num = 0,x;
scanf("%d",&n);
for(int i=1; i<=n; i++)
scanf("%d",&x),Heap[++num]=x,push_heap(Heap+1,Heap+num+1,greater<int>());
for(int i=1; i<=n; i++)
printf("%d ",Heap[1]),pop_heap(Heap+1,Heap+num+1,greater<int>()),num--;
return 0;
}

posted @ 2017-01-19 19:30  _Koreyoshi  阅读(163)  评论(0编辑  收藏  举报