摘要: 题意:给定一个序列,询问区间中最大数减去最小数的结果和2104差不多, 代码贴过来就OK了 1 #include 2 #include 3 using namespace std; 4 const int M = 100005; 5 int toLeft[20][M], tree[20][M], sorted[M]; 6 7 void build(int level, int left, int right) 8 { 9 if (left == right) return;10 int i, mid = (left + right) >>1;11 int supp... 阅读全文
posted @ 2013-06-28 18:41 旅行的蜗牛 阅读(143) 评论(0) 推荐(0) 编辑
摘要: 题意:给定一个数列,求一个区间的第K大数模板题, 其中的newl, newr 有点不明白. 1 #include 2 #include 3 using namespace std; 4 const int M = 100005; 5 int toLeft[20][M], tree[20][M], sorted[M]; 6 7 void build(int level, int left, int right) 8 { 9 if (left == right) return;10 int i, mid = (left + right) >>1;11 int supp... 阅读全文
posted @ 2013-06-28 18:36 旅行的蜗牛 阅读(139) 评论(0) 推荐(0) 编辑
摘要: BFS 几天的超时...A*算法不会,哪天再看去了. 1 /* 2 倒搜超时, 3 改成顺序搜超时 4 然后把记录路径改成只记录当前点的操作,把上次的位置记录下AC..不完整的人生啊 5 */ 6 7 #include 8 #include 9 #include 10 #include 11 #include 12 using namespace std; 13 14 const int MAXX_SIZE = 362885; 15 16 int fac[] = {1,1,2,6,24,120,720,5040,40320}; 17 b... 阅读全文
posted @ 2013-06-28 17:02 旅行的蜗牛 阅读(221) 评论(0) 推荐(0) 编辑