线段树
Devil Zoey
这个作者很懒,什么都没留下…
展开
-
hdu6681(线段树)
hdu6681题意在n*m的平面上有k条射线,问把这个平面切成多少块?思路预处理一下,按x左边排序,type=1表示开始的位置,type=2表示结束的位置,用线段树维护y轴,单点更新,区间查询.代码#include<bits/stdc++.h>using namespace std;const int maxn=1e5+10;int tree[maxn<...原创 2019-09-07 18:19:36 · 168 阅读 · 0 评论 -
2019牛客暑期多校第十场F
2019牛客暑期多校第十场F题意在二维平面内有n个气球,选择一个三条等间距的横线和竖线,问能最大打破多少个气球.思路枚举x坐标,用线段树维护y坐标(去重).代码#include<bits/stdc++.h>using namespace std;const int maxn=1e5+10;int tree[maxn<<2];void build(...原创 2019-09-09 16:46:07 · 88 阅读 · 0 评论 -
2019徐州网络赛E
2019徐州网络赛E题意给n,m,和长度为n的数组w,找最右边的j使得w[j]>=w[i]+m,输出中间的间隔的数的个数,如果没有输出-1.思路比赛时想到线段树贪心找右区间,找不到返回-1.(题解时单调队列做法).代码#include<bits/stdc++.h>using namespace std;const int maxn=5e5+10;int ...原创 2019-09-09 20:57:01 · 106 阅读 · 0 评论