上一页 1 2 3 4 5 6 7 8 9 10 ··· 13 下一页

2013年10月11日

hdu4614 Vases and Flowers 线段树+二分

摘要: 题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=4614题意:给你N个花瓶,编号是0 到 N - 1 ,初始状态花瓶是空的,每个花瓶最多插一朵花。然后有2个操作。操作1,a b c ,往在a位置后面(包括a)插b朵花,输出插入的首位置和末位置。操作2,a... 阅读全文

posted @ 2013-10-11 17:06 GyyZyp 阅读(171) 评论(0) 推荐(0) 编辑

2013年10月7日

hdu1255 覆盖的面积 线段树+里离散化求矩形面积的交

摘要: 题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=1255求矩形面积的交的线段树题目,刚做了求并的题目,再做这个刚觉良好啊,只要再加一个表示覆盖次数大于1次的长度变量即可代码: 1 #include 2 #include 3 #include 4 ... 阅读全文

posted @ 2013-10-07 16:37 GyyZyp 阅读(178) 评论(0) 推荐(0) 编辑

poj1151 Atlanis 线段树+离散化求矩形面积的并

摘要: 题目链接:http://poj.org/problem?id=1151很经典的题目,网上有很多模板代码,自己理解了一天,然后很容易就敲出来了。。。代码: 1 #include 2 #include 3 #include 4 #include 5 #include 6 #define ma... 阅读全文

posted @ 2013-10-07 16:34 GyyZyp 阅读(165) 评论(0) 推荐(0) 编辑

2013年10月6日

zoj 1013 Great Equipment DP

摘要: 题目链接:http://acm.zju.edu.cn/onlinejudge/showProblem.do?problemId=13很经典的一个DP的题目定义dp[i][num1][num2]表示前i个车装num1个装备1和num2个装备2之后最多能装的装备3的个数那么dp[i][p+x][q+y]... 阅读全文

posted @ 2013-10-06 15:20 GyyZyp 阅读(182) 评论(0) 推荐(0) 编辑

2013年10月4日

poj3067 Japan 树状数组求逆序对

摘要: 题目链接:http://poj.org/problem?id=3067题目就是让我们求连线后交点的个数很容易想到将左端点从小到大排序,如果左端点相同则右端点从小到大排序那么答案即为逆序对的个数用树状数组求解逆序对代码: 1 #include 2 #include 3 #include 4 #include 5 #include 6 using namespace std; 7 #define maxn 1010 8 int n,m,k; 9 int c[maxn*maxn];10 long long int ans;11 class point12 {13 public:14 i... 阅读全文

posted @ 2013-10-04 13:47 GyyZyp 阅读(136) 评论(0) 推荐(0) 编辑

hdu1556 Color the ball

摘要: 题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=1556思路:我自己是用线段树做的后来看了kuangbin的博客,发现用树状数组更简单,而且很妙,就自己也敲了一下对于会树状数组的同学来说理解代码应该很简单,直接贴代码了啊代码: 1 #include 2 #include 3 #include 4 #include 5 #include 6 using namespace std; 7 8 const int MAXN=100010; 9 int c[MAXN];10 int n;11 12 int lowbit(int x)13 {14 ... 阅读全文

posted @ 2013-10-04 10:59 GyyZyp 阅读(160) 评论(0) 推荐(0) 编辑

hdu1556 Color the ball 简单线段树

摘要: 题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=1556简单的线段树的应用直接贴代码了:代码: 1 #include 2 #include 3 #include 4 #include 5 #define maxn 100100 6 using names... 阅读全文

posted @ 2013-10-04 10:44 GyyZyp 阅读(175) 评论(0) 推荐(0) 编辑

2013年10月3日

poj2481 Cows 树状数组

摘要: 题目链接:http://poj.org/problem?id=2481解题思路:这道题对每组数据进行查询,是树状数组的应用。对于二维的树状数组,首先想到排序。现在对输入的数据按右值从大到小排序,在右值相同的情况下,左值从小到大排序。则对于每头牛,它前面的牛的右区间至少在它的右面,用树状数组可以快速查... 阅读全文

posted @ 2013-10-03 23:32 GyyZyp 阅读(384) 评论(0) 推荐(0) 编辑

hdu1541 Stars 树状数组

摘要: 题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=1541题目大意就是统计其左上位置的星星的个数由于y已经按升序排列,因此只用按照x坐标生成一维树状数组即可比较简单的题目:代码: 1 #include 2 #include 3 #include 4 #in... 阅读全文

posted @ 2013-10-03 11:39 GyyZyp 阅读(161) 评论(0) 推荐(0) 编辑

2013年10月2日

hdu698 Just a Hook 线段树-成段更新

摘要: 题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=1698很简单的一个线段树的题目,每次更新采用lazy思想,这里我采用了增加一个变量z,z不等于0时其绝对值表示当前区间的牌的性质并且代表更新到此区间代码: 1 #include 2 #include 3 ... 阅读全文

posted @ 2013-10-02 18:11 GyyZyp 阅读(119) 评论(0) 推荐(0) 编辑

上一页 1 2 3 4 5 6 7 8 9 10 ··· 13 下一页

导航