
线段树 树状数组
文章平均质量分 78
YDYKL
这个作者很懒,什么都没留下…
展开
-
POJ 1195 二维树状数组
#include #include #define M 1030 int c[M][M]; int LB[M]; int n; void Update(int x,int y,int k) { int i,j; x++; y++; wh原创 2011-07-21 19:23:38 · 468 阅读 · 0 评论 -
POJ3468
#include#define MIN -1000000001struct node{ int l,r; long long sum,lnc;//用__int64WA了无数次 }T[400010];void Init(int l,int r,int id){ T[id].l=l;原创 2011-07-19 20:36:01 · 426 阅读 · 0 评论 -
POJ 2528
#include #include #include using namespace std; int x[10100],y[10100];// bool v[10010]; int h[20020]; int a[10000010]; int num;原创 2011-07-19 20:47:06 · 381 阅读 · 0 评论 -
ZOJ 1743
多少个1 Time Limit: 5000MS Memory Limit: 65536K Total Submissions: 125 Accepted: 18 Description 一开始有n个0,编号1到n,接原创 2011-08-11 09:29:56 · 495 阅读 · 0 评论 -
ZOJ 1709
http://10.7.18.82/JudgeOnline/showproblem?problem_id=1709 最优子矩阵 Time Limit: 5000MS Memory Limit: 65536K Total Submissions原创 2011-08-11 08:53:40 · 547 阅读 · 0 评论 -
POJ 1151
http://poj.org/problem?id=1151 题意是 给你n个矩形的坐标 求矩形覆盖的总面积 离散化 #include #include #include #include #define M 300 #define eps 1e-6 using namespace std; struct trangle { double x1,y1,x2,y2原创 2011-11-05 10:00:47 · 1180 阅读 · 0 评论 -
HDU 3974
时间戳类型线段树。。。通过一个dfs给树中各节点重新分配一个遍历的序号。。 第一次写 感觉还是很不错的 #include #include #include #define M 50005 using namespace std; struct node { int l,r; int now,cover; }tree[M*8]; vector edge[原创 2011-11-09 20:04:19 · 619 阅读 · 0 评论 -
POJ 3321 Apple Tree
//树状数组做 /*一棵树上长了苹果,每一个树枝节点上有长苹果和不长苹果两种状态,两种操作,一种操作能够改变树枝上苹果的状态,另一种操作询问某一树枝节点一下的所有的苹果有多少。具体做法是做一次dfs,记下每个节点的开始时间Start[i]和结束时间End[i],那么对于i节点的所有子孙的开始时间和结束时间都应位于Start[i]和End[i]之间,另外用一个数组C[i]记录附加在节点i上的苹果的原创 2011-11-10 20:13:35 · 478 阅读 · 0 评论