![](https://img-blog.csdnimg.cn/20201014180756925.png?x-oss-process=image/resize,m_fixed,h_64,w_64)
排序
lt36
这个作者很懒,什么都没留下…
展开
-
堆排序代码
参考: 百度百科,堆排序代码:#include<cstdio>#include<iostream>#include<algorithm>using namespace std;typedef long long ll;const int maxn=1e5+5;int a[maxn];void min_heapify(int *a,int ...原创 2019-11-10 11:14:02 · 161 阅读 · 0 评论 -
Applese 的QQ群 拓扑排序+二分
链接:https://ac.nowcoder.com/acm/contest/330/F来源:牛客网 Applese 有一个QQ群。在这个群中,大家互相请教问题。如 b 向 a 请教过问题,就把 a 叫做是 b 的"老板"。这样一个群中就会有很多老板。同时规定:如果 a 是 b 的老板,b 是 c 的老板,那么 a 也是 c 的老板。为了不破坏群里面和谐交流的氛围,Applese ...原创 2019-01-29 16:55:15 · 154 阅读 · 0 评论 -
归并排序求逆序对
给你一个n个数的序列,求逆序对数是多少归并排序求逆序对数的板子:#include<iostream>#include<cstdio>using namespace std;typedef long long ll;const int maxn=5e5+5;int a[maxn],b[maxn];ll cnt;void merge_sort(int l...原创 2019-03-01 18:54:09 · 125 阅读 · 0 评论 -
快速排序代码
#include<iostream>using namespace std;const int maxn=1e5+5;int a[maxn];int n;void quicksort(int l,int r){ if(l<r){ int i=l,j=r; int x=a[i]; while(i<j){ ...原创 2019-03-19 16:07:19 · 101 阅读 · 0 评论