上一页 1 ··· 4 5 6 7 8 9 10 11 12 ··· 20 下一页

2014年10月25日

spoj375Query on a tree树链剖分

摘要: 学了下树链剖分,这个链接讲的很详细http://blog.sina.com.cn/s/blog_6974c8b20100zc61.html就是把一颗树划分轻重链,然后标号,对应到一颗线段树上。更新a到b的路径时,就把在下面的向上提 直到在一条重链上或者两点重合。#include #include #... 阅读全文

posted @ 2014-10-25 16:43 一个西瓜 阅读(142) 评论(0) 推荐(0)

2014年10月23日

Hdu4737 ( A Bit Fun ) 线段树

摘要: 题意:统计最后有多少对[i,j]使得其区间内所有的值的或的值#include #include #include #include #include #include #include #include #include #include #include #include using namesp... 阅读全文

posted @ 2014-10-23 20:03 一个西瓜 阅读(187) 评论(0) 推荐(0)

CodeForces 274E. Riding in a LiftDp

摘要: 题意:从a 开始不能到达b,要坐k次电梯的满足条件 :|x - y| #include #include #include #include #include #include #include #include #include #include #include #include using n... 阅读全文

posted @ 2014-10-23 19:58 一个西瓜 阅读(342) 评论(0) 推荐(0)

2014年10月21日

D. Red-Green Towers Dp

摘要: 题意:有两种颜色的积木 向上垒,每层只能是同一种颜色,且每层的个数等于层数。问有多少种垒法。Dp滚动数组搞下就好了。#include #include #include #include #include #include #include #include #include #include #i... 阅读全文

posted @ 2014-10-21 16:12 一个西瓜 阅读(280) 评论(0) 推荐(0)

Hdu5067旅行商

摘要: 题意:经历所有要求的点,最少距离。诶 i==x的时候 continue了,fst 挂了。#include #include #include #include #include #include #include #include #include #include #include #includ... 阅读全文

posted @ 2014-10-21 16:02 一个西瓜 阅读(170) 评论(0) 推荐(0)

Hdu5068线段树

摘要: 题意 :每层都有2个门,每个门后面都能通向下一层的两个门,有两个操作 ,第一个 问 从a层到 b层的方法数,第二个 修改 其中某门通向某门的状态。线段树单点更新,矩阵连通性构造 离散数学里有讲。#include #include #include #include #include #include... 阅读全文

posted @ 2014-10-21 16:00 一个西瓜 阅读(233) 评论(0) 推荐(0)

2014年10月15日

uva11992线段树

摘要: 诶 !线段树 建 20个 ,随便搞搞就好了。#include #include #include #include #include #include #include #include #include #include #include #include #include using names... 阅读全文

posted @ 2014-10-15 21:53 一个西瓜 阅读(160) 评论(0) 推荐(0)

2014年10月14日

uva1400线段树

摘要: 题意:在l,r区间找到 最靠近左边的和最大区间。要理清思路写。简单区间合并。查找要麻烦点,三个查找函数,分别是向左范围内最大连续,向右范围内最大连续,整体最大连续。#include #include #include #include #include #include #include #in... 阅读全文

posted @ 2014-10-14 11:47 一个西瓜 阅读(178) 评论(0) 推荐(0)

2014年10月13日

poj3368线段树

摘要: 题意:给出q次询问,求区间内最长的连续序列。 水题。1.RMQ 求法 ,st算法 2.线段树,简单的区间合并#include#include#includeusing namespace std;const int maxn = 111111;const int INF = 99999999;int... 阅读全文

posted @ 2014-10-13 17:42 一个西瓜 阅读(312) 评论(0) 推荐(0)

CodeForces 272F - Ant colony线段树

摘要: 题意:给出长度为n的串a,然后 给出q个询问 。对于每个询问 l,r,有一个计算其中对应的数的能量值的方法,比如power[l] 的计算方法就是 在区间[l,r]中能被 a[l]整除的数的个数。问这个区间中除去能量值等于r-l的个数还剩多少个。因为个数 等于r-l ,就相当于最小的数是 这个区间的最... 阅读全文

posted @ 2014-10-13 13:08 一个西瓜 阅读(230) 评论(0) 推荐(0)

上一页 1 ··· 4 5 6 7 8 9 10 11 12 ··· 20 下一页

导航