随笔分类 - 排序
摘要:水 A - Interview 注意是或不是异或 #include <bits/stdc++.h> int a[1005], b[1005]; int main() { int n; scanf ("%d", &n); for (int i=0; i<n; ++i) { scanf ("%d", a
阅读全文
摘要:水A - Wilbur and Swimming Pool自从打完北京区域赛,对矩形有种莫名的恐惧..#include using namespace std;typedef long long ll;const int N = 1e5 + 10;const int INF = 0x3f3f3f3f...
阅读全文
摘要:推迟了15分钟开始,B卡住不会,最后弃疗,rating只涨一分。。。水(暴力枚举)A - 2Char/************************************************* Author :Running_Time* Created Time :2015/...
阅读全文
摘要:题目传送门 1 /* 2 题意:给了两行的数字,相同的数字连线,问中间交点的个数 3 逆序数:第一行保存每个数字的位置,第二行保存该数字在第一行的位置,接下来就是对它求逆序数 4 用归并排序或线段树求。想到了就简单了:) 5 */ 6 #include 7 #inc...
阅读全文
摘要:题目传送门1 /*2 求逆序数的四种方法3 */ 1 /* 2 1. O(n^2) 暴力+递推 法:如果求出第一种情况的逆序列,其他的可以通过递推来搞出来,一开始是t[1],t[2],t[3]....t[N] 3 它的逆序列个数是N个,如果把t[1]放到t[N]后面,逆序列个...
阅读全文
摘要:题目传送门 1 /* 2 用zstu3539题目来验证算法的正确性 3 */ 4 #include 5 #include 6 #include 7 #include 8 #include 9 using namespace std;10 11 const int maxn = 10...
阅读全文
摘要:题目传送门 1 /* 2 插入排序——扑克牌排序 3 用zstu3539题目来验证算法的正确性 4 */ 5 #include 6 #include 7 #include 8 #include 9 #include 10 using namespace std;11 12 c...
阅读全文
摘要:题目传送门 1 /* 2 BubbleSort_2(),_3()为优化版 3 用zstu3539题目来验证算法的正确性 4 */ 5 #include 6 #include 7 #include 8 #include 9 #include 10 using namespace...
阅读全文
摘要:题目传送门 1 /* 2 暴力 超时 O(n^2) 3 */ 4 #include <stdio.h> 5 6 const int MAX_N = 500000; 7 int a[MAX_N+10]; 8 long long cnt = 0; 9 10 int main(void) //POJ 22
阅读全文