原题链接:http://acm.hdu.edu.cn/showproblem.php?pid=2795题意:给出广告板的高和宽,然后在给出1*m的广告,判断每块广告牌是否能放开,原则是广告尽量往广告牌的左上角放。源码:#include<iostream>using namespace std;#define lson l,mid,index<<1#define rson mid+1,r,index<<1|1#define MAX 222222int node[MAX<<2];int h,w,num;void build(int l,int r,i Read More
posted @ 2013-03-30 15:47
supersnow0622
Views(122)
Comments(0)
Diggs(0)
原题链接:http://acm.hdu.edu.cn/showproblem.php?pid=1754(区间最大值)源码:#include<iostream>using namespace std;#define lson l,mid,index<<1#define rson mid+1,r,index<<1|1#define max 200000int score[max<<2];char ch;void getMax(int index){ score[index]=score[index<<1]>score[index&l Read More
posted @ 2013-03-30 15:35
supersnow0622
Views(131)
Comments(0)
Diggs(0)
最近一个周在学习线段树,晒晒学习成果。线段树结构:以最大区间是10为例 1【1 , 10】 / \ 2【1,5】 3【6,10】 / \ / \ 4【1,3】 5【4,5】 6【6,8】 7【9,10】 / \ / \ / \ / \ 8【1,2】9【3,3】10【4,4】11【5,5】 12【6,7】13【8,8】14【9,9】15【10,10】 / \... Read More
posted @ 2013-03-30 15:31
supersnow0622
Views(130)
Comments(0)
Diggs(0)

浙公网安备 33010602011771号