随笔分类 -  数据结构——线段树和树状数组

摘要:先二分答案转化成判定问题。 考虑拿一根扫描线从 $x=0$ 扫到 $x=n$,每次移动扫描线更新每个位置它上面的点数和下面的点数,这样可以确定在当前的扫描线上哪些位置对于 $y$ 轴方向是合法的。对于 $x$ 轴方向合法的点应该处的范围可以直接算出来,树状数组维护。 cpp include incl 阅读全文
posted @ 2018-02-13 21:47 poorpool 阅读(149) 评论(0) 推荐(0)
摘要:```cpp include include include include using namespace std; typedef long long ll; int n, m; ll a[500005], uu, vv, lst, qzh[500005]; struct SGT{ ll sum 阅读全文
posted @ 2018-02-11 17:33 poorpool 阅读(574) 评论(0) 推荐(0)
摘要:```cpp #include #include using namespace std; typedef long long ll; int n, m, T, uu, vv, ww; const int mod=1000000007; char ss[100005]; struct Matrix{ int ma[3][3]; Matrix operator * (const Matrix... 阅读全文
posted @ 2018-02-11 16:04 poorpool 阅读(118) 评论(0) 推荐(0)
摘要:差分一下上线段树 阅读全文
posted @ 2018-02-11 10:33 poorpool 阅读(142) 评论(0) 推荐(0)
摘要:线段树加乘懒标记裸题。 阅读全文
posted @ 2017-11-20 11:50 poorpool 阅读(206) 评论(0) 推荐(0)