- 博客(4)
- 收藏
- 关注
原创 倍增求LCA,树上差分(点,边)
@TOC 一级目录 先dfs一遍求深度和f[][]数组 #include<bits/stdc++.h> using namespace std; const int maxn=100005; int head[maxn],to[maxn<<1],nex[maxn<<1]; int n,m,tot; int dis[maxn],far[maxn][25]; void add(int x,int y) { nex[++tot]=head[x]; to[to
2021-03-02 13:42:17 68
原创 离线分治算法
CDQ分治偏序三维偏序 偏序 三维偏序 洛谷P3810 【模板】三维偏序(陌上花开) 洛谷题解:https://www.luogu.com.cn/blog/handsome-wzb/solution-p3810
2021-03-02 13:41:50 154
原创 分块
分块P4168 [Violet]蒲公英 P4168 [Violet]蒲公英 洛谷题解:https://www.luogu.com.cn/problem/solution/P4168 首先暴力统计区间众数的时间复杂度为接近O(n^2),时间复杂度不够优秀,所以我们 遇事不决先分块考虑分段处理。数据范围比较大,所以我们离散化。所谓离散化就是将数据排好序后用ta的排名来代替ta本身(需要另开一个数组)。nlog(n)时间内就能完成。 void yych()//离散化 { len=sqrt(n); memse
2021-02-23 16:19:32 97
原创 扫描线(线段树)详解
https://blog.csdn.net/xianpingping/article/details/83032798 看过讲的最好的一篇博客
2020-03-12 11:44:56 150
空空如也
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人