
线段树
lcxdz
这个作者很懒,什么都没留下…
展开
专栏收录文章
- 默认排序
- 最新发布
- 最早发布
- 最多阅读
- 最少阅读
-
覆盖的面积 (扫描线 线段树 离散化
添加链接描述 #include<bits/stdc++.h> using namespace std; const int N=2e3+9; struct node { double x,y1,y2; int cover; bool operator <(const node &k)const{ return x<k.x; } }t[N*2]; struct segment { int l,r,cnt; doub原创 2022-03-30 22:01:16 · 208 阅读 · 0 评论 -
247. 亚特兰蒂斯 (扫描线 二分 离散化
添加链接描述 #include<bits/stdc++.h> using namespace std; const int N=2e4+9; vector<double>num; struct node{ double x,y1,y2; int cover; bool operator < (const node &p)const{ return x<p.x; } }t[N*2]; struct segmen{原创 2022-03-30 17:40:05 · 216 阅读 · 0 评论 -
1228. 油漆面积 (扫描线 线段树 模板
添加链接描述 #include<bits/stdc++.h> using namespace std; const int N=1e4+9; struct node { int x,y1,y2; int cover; bool operator <(const node &t)const{ return x<t.x; } }t[N*2]; struct segment { int l,r; int cnt;原创 2022-03-29 20:50:04 · 212 阅读 · 0 评论 -
1265. 数星星(线段树
添加链接描述 #include<bits/stdc++.h> using namespace std; const int N=32009; struct node{ int l,r,data; }t[N*4]; void pushup(int u){ t[u].data=t[u*2].data+t[u*2+1].data; } void build(int u,int l,int r){ if(l==r)t[u]={l,r}; else { t[原创 2022-03-28 11:59:48 · 159 阅读 · 0 评论 -
1264. 动态求连续区间和 (线段树 模板
添加链接描述 #include<bits/stdc++.h> using namespace std; const int N=1e5+9; struct node { int l,r; int data; }t[4*N]; int arr[N]; void pushup(int u){ t[u].data=t[u<<1].data+t[u<<1|1].data; } void build(int u,int l,int r){ if(l=原创 2022-03-28 11:26:58 · 143 阅读 · 0 评论 -
1270. 数列区间最大值(线段树 RMQ
添加链接描述 #include<bits/stdc++.h> using namespace std; const int N=1e5+9; int arr[N]; struct node { int l,r,data; }t[N*4]; void build(int u,int l,int r){ if(l==r){t[u]={l,r,arr[r]}; // cout<<u<<"---"<<r<<endl;原创 2022-03-27 21:23:56 · 215 阅读 · 0 评论