排序
AresDLEX
Ares does not fall
展开
专栏收录文章
- 默认排序
- 最新发布
- 最早发布
- 最多阅读
- 最少阅读
-
NYOJ 233 Sort it
1、数据不大,1000内,暴力循环写法时间复杂度O(N^2),水题 2、归并排序的模板写法,归并排序求逆序对,水题 一、暴力写法 #include<cstdio> #include<iostream> #include<cstring> using namespace std; const int MAXN=1e3; int dp[MAXN+10]; ...原创 2018-10-22 13:34:25 · 239 阅读 · 0 评论 -
HDU 4911 Inversion
1、归并排序求逆序对,水题。 2、最多只能k次操作,剩下逆序对即为mergeSort()-k(与0比较,有可能操作数大于原逆序对)。 #include<cstdio> #include<iostream> #include<algorithm> using namespace std; const int MAXN=1e5; int num[MAXN+1...原创 2018-10-22 13:59:30 · 272 阅读 · 0 评论 -
HDU 6318 Swaps and inversions
1、依旧是归并排序逆序对的模板,水题,因为交换次数就是逆序对,直接比较x和y大小就行。 2、树状数组也可以做。 一、mergeSort #include<cstdio> #include<iostream> #include<algorithm> using namespace std; const int MAXN=1e5; int num[MAXN...原创 2018-10-22 14:29:00 · 288 阅读 · 0 评论
分享