![](https://img-blog.csdnimg.cn/20201014180756754.png?x-oss-process=image/resize,m_fixed,h_64,w_64)
Segment tree
Yukar_syt
这个作者很懒,什么都没留下…
展开
-
Hit the Target!
1.与star in the window 差不多 降维#include#include#include#includeusing namespace std;#define LL(x) (x<<1)#define RR(x) ((x<<1)|1)int n,m,p,q;int c;const int maxn=50005;struct Seg{原创 2012-04-23 20:32:19 · 734 阅读 · 0 评论 -
Little Elephant and Strings CF204E 注意何时线段树update()
#include#include#includeusing namespace std;typedef __int64 lld;const int maxn=200005;//以下为倍增算法求后缀数组int wa[maxn],wb[maxn],wv[maxn],Ws[maxn];int cmp(int *r,int a,int b,int l){return r[a]==r[原创 2012-11-06 16:12:28 · 858 阅读 · 0 评论 -
ZOJ Toy Blocks
#include#include#includeusing namespace std;typedef long long lld;const int maxn=100005;struct Node{ lld x; lld h; bool operator <(const Node &t)const { return x<t.x; }}p[maxn];lld R[原创 2012-10-07 03:00:32 · 749 阅读 · 0 评论 -
Coder
//sum[id]存的是[l,r]区间中id=i%5的值#include#include#includeusing namespace std;typedef __int64 lld;const int maxn=100005;struct Seg{ int l,r; int num; lld sum[5];}tree[maxn<<2];ch原创 2012-09-16 21:03:06 · 530 阅读 · 0 评论 -
Let the light guide us HDU
//inline 快读 交C++ 加速//懒标记的不同记录//DP+线段树 题目中的要求 |j-k|≤f(i,j)+f(i+1,k)可以理解成// j点:以j为中心的半径f(i,j)的区间和以k为中心的半径f(i+1,k)的区间//一个是插入区间 ,一个是查询最小的区间//代码参考http://blog.csdn.net/wukonwukon/article/details/702059原创 2012-08-11 22:52:30 · 727 阅读 · 0 评论 -
HDU Boring counting 树状数组
//树状数组区间更新//树形结构->线性结构DFS处理//求区间有K个相同的有多少数字//每个节点表示到i的区间有几个K相同值#include#include#include#includeusing namespace std;const int maxn=100005;int B[maxn];int val[maxn];int vx[maxn];int L[maxn原创 2012-08-10 23:20:09 · 654 阅读 · 0 评论 -
1188 - Fast Queries Lightoj
1.扫描线2.使相同的点尽量靠右原创 2012-08-08 18:27:14 · 1484 阅读 · 0 评论 -
HDU Image Recognition
//先得把模型抽象出来,找出要统计的,那些不在统计范围内的根据情况的不同,用相应的方法分开//扫描线->对后面统计有作用的留下 对后面统计没做用的删去//离线排序 用flag表示产生作用和没作用,然后依次统计#include#include#includeusing namespace std;const int maxn=1005;int map[maxn][maxn];in原创 2012-08-07 10:49:15 · 452 阅读 · 0 评论 -
D. Ball CF
D. Balltime limit per test3 secondsmemory limit per test256 megabytesinputstandard inputoutputstandard outputN ladies attend the ball in the King's palace. Every原创 2012-05-12 21:31:26 · 1217 阅读 · 0 评论 -
Segment tree
Problem E: BSTTime Limit: 1 Sec Memory Limit: 128 MBSubmit: 51 Solved: 12[Submit][Status][Web Board]DescriptionA binary search tree is a tree in which every node has at most two childr原创 2012-04-21 00:29:32 · 625 阅读 · 0 评论 -
E. Linear Kingdom Races
http://codeforces.com/problemset/problem/115/E//dp[i]表示 [i...i]最多能赚多少钱//dp[i+1]=max(dp[i],dp[k]-sum(cost[k..i])+sum(profit[k...i])) 1<=k<i;//两个转移分别是1.不修路,2.把修[k...i]能赚得钱//线段树优化#include#incl原创 2012-04-26 20:54:32 · 671 阅读 · 0 评论 -
Codeforces D. Points
/*http://blog.csdn.net/acm_cxlove/article/details/8900107线段树维护x轴上y的最大值 ,set存储每一个x上y的集合确定在哪一维上后,利用set二分*/#include#include#include#includeusing namespace std;const int maxn = 200005;int n,翻译 2013-08-17 20:56:42 · 688 阅读 · 0 评论