![](https://img-blog.csdnimg.cn/20201014180756928.png?x-oss-process=image/resize,m_fixed,h_64,w_64)
其他---倍增
forezxl
水君一枚
展开
-
BZOJ2783 [JLOI2012]树(洛谷P3252)
倍增 BZOJ题目传送门 洛谷题目传送门 水水更健康 可以发现以iii为起点的一条合法路径一定是在iii到根的路径上的。那么预处理后直接倍增跳一跳就好了。 代码: #include<cctype> #include<cstdio> #include<cstring> #include<algorithm> #define N 100005...原创 2018-08-08 20:48:15 · 150 阅读 · 0 评论 -
BZOJ4568: [Scoi2016]幸运数字(洛谷P3292)
线性基 倍增 BZOJ题目传送门 洛谷题目传送门 预处理xxx跳了2j2^j2j的线性基,每次询问倍增跳并合并线性基,最后查一下最大值就好了。复杂度O(60∗60∗mlogn)O(60*60*m\log n)O(60∗60∗mlogn) 代码: #include<cctype> #include<cstdio> #include<cstring> #inclu...原创 2018-10-12 17:10:18 · 128 阅读 · 0 评论