p3110 二叉堆练习3--排序
来源:互联网 发布:淘宝网总裁张杰 编辑:程序博客网 时间:2024/06/07 21:10
/*作者:QHY题目:p3110 二叉堆练习3*/#include<cstdio>#include<iostream>#include<cstring>#include<queue>using namespace std;struct node{ int l,r,n;};int x,y,n;priority_queue<int,vector<int>,greater<int> >q;int main(){ cin>>n; while(n--){ cin>>x; q.push(x); } while(!q.empty()){ cout<<q.top()<<' '; q.pop(); } return 0;}
#include<cstdio>#include<iostream>#include<cstring>#include<queue>#include<algorithm>using namespace std;struct node{ int l,r,n;};int x,y,n,i;int a[500001];int main(){ cin>>n; while(n--){ cin>>a[i++]; } sort(a,a+i,greater<int>()); //stable_sort(a,a+i,greater<int>()); while(i--)cout<<a[i]<<' '; return 0;}
0 0
- p3110 二叉堆练习3--排序
- 【二叉堆、堆排序】
- 二叉堆 & 堆排序
- 二叉堆 & 堆排序
- 二叉堆 & 堆排序
- codevs 3110 二叉堆练习3
- heapSort - 堆排序 / 二叉堆
- heapSort - 堆排序 / 二叉堆
- 二叉堆(堆排序)
- 二叉堆与堆排序
- (二叉堆,堆排序)
- 数据结构 二叉堆 & 堆排序
- 二叉堆与堆排序
- 二叉堆和堆排序
- 编程练习:堆排序
- [每日练习]堆排序
- 堆排序练习代码
- 堆排序的练习
- QList<T> 的释放分两种情况
- Python(x,y)安装
- 【Spring】Spring之我见
- codeforces373B#
- BZOJ 2502 清理雪道
- p3110 二叉堆练习3--排序
- getline函数
- hihocoder 1353 满减优惠,背包
- 创业--节奏感
- 自述
- Alex-net 十大问
- |洛谷|DFS|P1019 单词接龙
- codeforces-373#C
- 一个菜鸟的编程路