ACM-树状数组与线段树
文章平均质量分 55
4546love
这个作者很懒,什么都没留下…
展开
专栏收录文章
- 默认排序
- 最新发布
- 最早发布
- 最多阅读
- 最少阅读
-
HDU 1542
#include #include using namespace std; #define N 201 struct node { int l,r,cover; double len; int getmid(){ return (r+l)>>1; } }p[3*N]; struct Line { double l,r,h; int flag; }L[N]; double h[N]; double X[N];原创 2011-04-18 20:26:00 · 2223 阅读 · 0 评论 -
HDU 3450 Counting Sequences
http://acm.hdu.edu.cn/showproblem.php?pid=3450#include #include using namespace std; #define mod 9901 #define N 100005 int a[N],b[原创 2011-07-03 10:55:32 · 998 阅读 · 0 评论 -
HDU 2492 Ping pong
http://acm.hdu.edu.cn/showproblem.php?pid=2492#includeusing namespace std;#define N 100001#define M 20001__int64 c[N];int a[M];__int64 L[M],R[M];int lowbit(int x){ return x&(-x);}原创 2011-06-30 19:58:00 · 1072 阅读 · 0 评论 -
poj 3468 lazy
<br />http://poj.org/problem?id=3468<br />#include<iostream> using namespace std; #define N 100001 struct node { int l,r; long long sum; long long type; int getmid(){ return (l+r)>>1; } int getdis(){ return r-l+1; } }p[3*N]; int a原创 2011-04-21 22:11:00 · 669 阅读 · 0 评论 -
HDU 1698 lazy
<br />http://acm.hdu.edu.cn/showproblem.php?pid=1698<br />#include<iostream> using namespace std; #define N 100001 struct node { int l,r; int type; int getmid(){ return (l+r)>>1; } int getdis(){ return r-l+1;原创 2011-04-21 15:54:00 · 580 阅读 · 0 评论 -
poj 2777
<br />http://poj.org/problem?id=2777<br />#include<iostream> #include<cstdio> #include<cstring> using namespace std; #define N 100001 struct node { int l,r; int type; int getmid(){ return (l+r)>>1; } }p[4*N]; bool h[N]; void build(int l原创 2011-04-21 15:52:00 · 1042 阅读 · 0 评论 -
poj 3264
<br />http://poj.org/problem?id=3264<br />#include<iostream> #include<cstdio> #include<cstring> #define N 50000 using namespace std; int a[N]; struct node { int l,r; int _max,_min; int getmid(){ return (l+r)>>1; } }p[N*4]; int原创 2011-04-21 13:05:00 · 633 阅读 · 0 评论 -
HDU 2838 树状数组
<br />题意:给你N个排列不规则的数,任务是把它从小到大排好,每次只能交换相邻两个数,交换一次的代价为两数之和,求最小代价<br />#include<iostream> using namespace std; #define N 100001 int n; struct node { int index; __int64 sum; }c[N]; int lowbit(int x) { return x&(-x); } void update(int x,int k,i原创 2011-04-19 12:46:00 · 2757 阅读 · 1 评论 -
HDU 2688
#include using namespace std; #define N 3000005 int c[10001]; int a[N]; int lowbit(int x) { return x&(-x); } void update(int x,int k) { while(x0) { ans+=c[x]; x-=lowbit(x); } return ans; } int main(void) { int n; while(~scan原创 2011-04-18 21:25:00 · 1359 阅读 · 1 评论 -
HDU 1255
题目大意:求矩形相交部分面积和#include #include using namespace std; #define N 2001 struct node { int l,r,cover; double one_len,more_len; int getmid(){ return (l+r)>>1; } }p[3*N]; struct Line { double l,r,h; int flag; }L[N]原创 2011-04-18 20:57:00 · 1546 阅读 · 0 评论 -
树状数组
一.下标是否为0......二.数据是否有重复的值三.数据是否要离散化四.操作区间 [x,y], x是否大于y暂时记到这里原创 2011-07-07 11:55:25 · 448 阅读 · 0 评论
分享