![](https://img-blog.csdnimg.cn/20201014180756925.png?x-oss-process=image/resize,m_fixed,h_64,w_64)
数据结构学习
文章平均质量分 72
Lawrence_Jang
这个作者很懒,什么都没留下…
展开
-
hoj 2430 树状数组 简单题
#include#include#include#include#include#include#include#include#include#include#include#include#include#include#include#define iinf 2000000000#define linf 1000000000000000000LL#defin原创 2012-10-09 10:51:14 · 446 阅读 · 0 评论 -
线段树成段更新 poj 3325
#include#include#include#include#include#include#include#include#include#include#include#include#include#include#include#define iinf 2000000000#define linf 1000000000000000000LL#defin原创 2012-10-13 17:39:52 · 376 阅读 · 0 评论 -
poj 3667 hotel 线段树成段更新区间合并
#include#include#include#include#include#include#include#include#include#include#include#include#include#include#include#define iinf 2000000000#define linf 1000000000000000000LL#defin原创 2012-10-13 20:50:54 · 402 阅读 · 0 评论 -
hdu 1542 扫描线线段树
#include#include#include#include#include#include#include#include#include#include#include#include#include#include#include#define iinf 2000000000#define linf 1000000000000000000LL#defin原创 2012-10-14 15:51:24 · 347 阅读 · 0 评论 -
hdu 1828线段树扫描线求周长并
#include#include#include#include#include#include#include#include#include#include#include#include#include#include#include#define iinf 2000000000#define linf 1000000000000000000LL#defin原创 2012-10-14 17:58:10 · 568 阅读 · 0 评论 -
hdu 1231 最大连续子序列 yy+dp+数据结构解法
1:线段树解法 对于每一个i求出最大的(i-k)区间内的sum值及id#include#include#include#include#include#include#include#include#include#include#include#include#include#include#include#define iinf 0x7f7f7f7f#def原创 2012-10-23 17:41:46 · 1007 阅读 · 0 评论 -
hdu 1711 kmp水体
#include#include#include#include#include#include#include#include#include#include#include#include#include#include#include#define iinf 0x7f7f7f7f#define linf 1000000000000000000LL#defin原创 2012-10-26 11:36:08 · 379 阅读 · 0 评论 -
poj 3481 treap 练习
#include#include#include#includeusing namespace std;const int inf=~0U>>1;struct ps{ int id,val; ps(int _i=0,int _val=0){id=_i;val=_val;} friend bool operator <(ps q,ps p) {原创 2012-11-25 16:00:11 · 797 阅读 · 1 评论 -
poj 2761 treap
利用区间的有序性才可以用treap 其实这题 线段树和树状数组时更好的选择 稍后补上#include#include#include#includeusing namespace std;const int inf=~0U>>1;class treap{ struct node { int val,key,size; node原创 2012-11-23 14:30:51 · 1054 阅读 · 0 评论 -
poj 1785
#include#include#include#include#includeusing namespace std;const int inf=~0U>>1;struct ps{ char s[11]; int w; int l,r; friend bool operator <(ps p,ps q){return strcmp(p.s,q.s原创 2012-11-26 20:32:13 · 1016 阅读 · 2 评论 -
poj 3481 sbt 版本
#include#includeusing namespace std;const int inf=~0U>>1;struct ps{ int id,val; ps(int _i=0,int _val=0){id=_i;val=_val;} friend bool operator <(ps q,ps p) { return q.val<p原创 2012-11-28 20:05:51 · 877 阅读 · 2 评论 -
hdu1520为例子谈谈关于递归和非递归的 转换
首先上一个非递归的代码 hdu 1520#include#include#include#include#include#include#include#include#include#include#include#include#include#include#define iinf 2000000000#define linf 1000000000000原创 2012-11-17 18:57:12 · 628 阅读 · 1 评论 -
哈夫曼树编码
由于建成树的随机性以及编码的随机性文件的读入不能以ascii码形式读入ascii码的读入方式会忽略掉一些流不能完整读入 所以要用二进制码读入方式下面是压缩的代码#include#include#include#include#includeusing namespace std;struct heap{ int ele[22222]; int原创 2012-10-27 08:55:02 · 634 阅读 · 0 评论 -
关于拓扑排序
深度优先搜索求出拓扑序列#include#include#include#include#include#include#includeusing namespace std;#define vi vectorvi a[100];int n,m;int ans[10000];int id;bool is[11111];void dfs(int r){ is原创 2012-12-28 20:47:16 · 447 阅读 · 0 评论 -
带返还值的非递归 bs算法为例子
#include#include#include#include#include#include#define N 20000using namespace std;int Max(int x,int y){if(x<y) return y;return x;}int p[N];struct seg{ int s,e; seg(int _s=0,int _e=原创 2012-12-20 18:42:33 · 3290 阅读 · 3 评论 -
Codeforces Round #149 (Div. 2):XOR on Segment
- -20棵线段树好久没写#include#include#include#include#include#include#include#include#include#include#define iinf 2000000000#define sz(x) x.size()#define pb push_back#define mp make_pair#de原创 2013-01-28 19:23:07 · 384 阅读 · 0 评论 -
poj 2201 笛卡尔树
#include#include#include#include#include#include#include#include#include#include#include#include#include#include#include#define iinf 2000000000#define linf 1000000000000000000LL#defin原创 2012-10-13 12:58:56 · 452 阅读 · 0 评论 -
poj 2528 线段树成段更新+离散化
#include#include#include#include#include#include#include#include#include#include#include#include#include#include#include#define iinf 2000000000#define linf 1000000000000000000LL#defin原创 2012-10-11 19:13:54 · 452 阅读 · 0 评论 -
poj 3468 线段树成段更新
#include#include#include#include#include#include#include#include#include#include#include#include#include#include#include#define iinf 2000000000#define linf 1000000000000000000LL#defin原创 2012-10-11 16:27:06 · 437 阅读 · 0 评论 -
poj 3067 树状数组 水
#include#include#include#include#include#include#include#include#include#include#include#include#include#include#include#define iinf 2000000000#define linf 1000000000000000000LL#defin原创 2012-10-09 15:55:30 · 435 阅读 · 0 评论 -
树状数组简单poj 2481
#include#include#include#include#include#include#include#include#include#include#include#include#include#include#include#define iinf 2000000000#define linf 1000000000000000000LL#defin原创 2012-10-08 17:34:18 · 353 阅读 · 0 评论 -
hoj 1867 水~~~树状数组
#include#include#include#include#include#include#include#include#include#include#include#include#include#include#include#define iinf 2000000000#define linf 1000000000000000000LL#defin原创 2012-10-08 20:08:40 · 474 阅读 · 0 评论 -
hoj 1640 树状数组 简单题
#include#include#include#include#include#include#include#include#include#include#include#include#include#include#include#define iinf 2000000000#define linf 1000000000000000000LL#defin原创 2012-10-09 11:32:37 · 487 阅读 · 0 评论 -
hdu 1541 树状数组简单
#include#include#include#include#include#include#include#include#include#include#include#include#include#include#include#define iinf 2000000000#define linf 1000000000000000000LL#defin原创 2012-10-08 16:46:34 · 491 阅读 · 0 评论 -
hoj 2275 树状数组 水··不能int 64
#include#include#include#include#include#include#include#include#include#include#include#include#include#include#include#define iinf 2000000000#define linf 1000000000000000000LL#defin原创 2012-10-09 12:00:16 · 610 阅读 · 0 评论 -
poj 2892 hdu 1540 不错的线段树题
#include#include#include#include#include#include#include#include#include#include#include#include#include#include#include#define iinf 2000000000#define linf 1000000000000000000LL#defin原创 2012-10-10 16:00:30 · 575 阅读 · 0 评论 -
poj 2299 树状数组离散化逆序数 水
#include#include#include#include#include#include#include#include#include#include#include#include#include#include#include#define iinf 2000000000#define linf 1000000000000000000LL#defin原创 2012-10-09 21:56:30 · 528 阅读 · 0 评论 -
树状数组模板区间更新 区间询问
14、树状数组(1)、单点增减+区间求和思路:C[x]表示该点的元素:sum(x)=C[1]+C[2]+……C[x]int arr[MAXN];inline int sum(int x){int res=0;while(x)res+=arr[x],x-=lowbit(x);return res;}inline void add(int x,int n){while(x<MAXN)a转载 2012-10-09 21:59:37 · 7902 阅读 · 3 评论 -
poj 2182 线段树水 或者树状数组+二分
线段树代码#include#include#include#include#include#include#include#include#include#include#include#include#include#include#include#define iinf 2000000000#define linf 1000000000000000000LL原创 2012-10-10 11:31:59 · 700 阅读 · 0 评论 -
poj 2155 Matrix 树状数组 区间更新单点求值
#include#include#include#include#include#include#include#include#include#include#include#include#include#include#include#define iinf 2000000000#define linf 1000000000000000000LL#defin原创 2012-10-10 12:05:59 · 434 阅读 · 0 评论 -
hdu 3584 三维树状数组 区间 更新 单点求值
#include#include#include#include#include#include#include#include#include#include#include#include#include#include#include#define iinf 2000000000#define linf 1000000000000000000LL#defin原创 2012-10-10 19:44:41 · 492 阅读 · 0 评论 -
hdu 1698 线段树成段更新简单题。
#include#include#include#include#include#include#include#include#include#include#include#include#include#include#include#define iinf 2000000000#define linf 1000000000000000000LL#defin原创 2012-10-11 15:45:57 · 390 阅读 · 0 评论 -
poj 3321 apple tree 树状数组 水
#include#include#include#include#include#include#include#include#include#include#include#include#include#include#include#define iinf 2000000000#define linf 1000000000000000000LL#defin原创 2012-10-09 21:34:27 · 406 阅读 · 0 评论 -
hdu 1892 树状数组二维 水
#include#include#include#include#include#include#include#include#include#include#include#include#include#include#include#define iinf 2000000000#define linf 1000000000000000000LL#defin原创 2012-10-10 20:22:16 · 401 阅读 · 0 评论 -
Codeforces Round #169 (Div. 2):E - Little Girl and Problem on Trees
#include#include#include#include#include#include#include#define iinf 1000000000#define pb push_back#define mp make_pair#define lng long long#define sqr(a) ((a)*(a))#define pii pair#define原创 2013-03-06 15:14:53 · 728 阅读 · 0 评论