![](https://img-blog.csdnimg.cn/20201014180756738.png?x-oss-process=image/resize,m_fixed,h_64,w_64)
版子
文章平均质量分 78
jackzhan01
jackzhan
展开
-
hdu2665-主席树
题目大意静态区间第 k 小数给定一个长度为 n 的序列 A,你需要回答 q 次询问。每次询问给定l; r; k,你需要回答 A 序列 [l; r] 区间内第 k 小的数字。n; q ≤ 105; 1 ≤ k ≤ r − l + 1; 1 ≤ l ≤ r ≤ n; jAij ≤ 109思路我们对于每个前缀 i,求出包含 A1; A2; ; Ai 所有元素的权值线段树。询问时只需要在...原创 2019-01-27 18:45:20 · 167 阅读 · 0 评论 -
点分治模板
https://www.luogu.org/problemnew/show/P3806点分治点分治的分治中心是重心,所以先要会找重心找重心void getroot(int u,int fa){ sim[u]=1;mxson[u]=0; for(int i=head[u];i;i=edge[i].nxt) { int v=edge[i].v; int w=edge[i]....原创 2019-01-28 13:12:43 · 198 阅读 · 0 评论 -
聪聪可可-点分治P2634
https://www.luogu.org/problemnew/show/P2634思路点分治考虑solve,发现我们可以记录一个cnt[0],cnt[1],cnt[2],分别代表经过根的dis值%3余0、1、2。那么对答案的贡献就是cnt[0]^2+2(1->2,2->1算两个)*cnt[1]*cnt[2]。code#include<iostream>#...原创 2019-01-28 15:18:02 · 124 阅读 · 0 评论 -
树链剖分
代码思路https://www.cnblogs.com/George1994/p/7821357.html传送门https://www.luogu.org/problemnew/show/P3384#include&amp;amp;lt;iostream&amp;amp;gt;#include&amp;amp;lt;cstdio&amp;amp;gt;#include&amp;amp;lt;cstri转载 2018-10-21 21:44:57 · 159 阅读 · 0 评论 -
二分图总结
二分图整理原创 2019-01-29 11:30:02 · 153 阅读 · 0 评论 -
LCA 最近公共祖先
LCA原创 2019-07-18 16:41:04 · 95 阅读 · 0 评论 -
luogu1020导弹拦截LIS模版(lower_bound用法)
最长上升子序列LIS-导弹拦截lower_bound&&upper_bound用法原创 2019-07-19 19:29:20 · 293 阅读 · 0 评论 -
矩阵快速幂模板(重载运算符)
题意求斐波那契数列第n项,n<=1e18solution1.显然O(n)递推肯定不行2.所以我们考虑用矩阵快速幂加速递推#include<iostream>#include<cstdio>#include<cstring>#include<algorithm>#include<queue>#include&l原创 2018-11-05 22:55:38 · 2414 阅读 · 0 评论 -
数位dp模板+总结
1.不要62和42.包含13且被13整除3.windy数(前导零)4.P4124 [CQOI2016]手机号码5.P4317 花神的数论题6. 数字统计原创 2018-11-07 19:48:34 · 124 阅读 · 0 评论 -
最短路算法
floyd,dijkstra,spfa(SLF),etx...原创 2018-10-31 11:39:18 · 164 阅读 · 0 评论 -
luogu_2341 tarjan图论
传送门https://www.luogu.org/problemnew/show/P2341思路先缩点(tarjan版子)只能有一个强联通分量的出度为0#include&lt;iostream&gt;#include&lt;cstdio&gt;#include&lt;cstring&gt;#include&lt;algorithm&gt;原创 2018-10-31 10:30:08 · 133 阅读 · 0 评论 -
10.31逆序对luogu1908
传送门https://www.luogu.org/problemnew/show/P1908思路考虑i产生的逆序对就是i前面比他大的数的个数(区间查询)考虑i对后面产生的影响就是他会给比他小的数产生贡献,或者说i这个数有了,出现了(单点修改)显然可以用树状数组或线段树维护plus我们考虑把一个序列a通过最少的交换次数使之变成b(a,b皆为1-n的排列),只要把a的元素与位置映射,再...原创 2018-10-31 16:26:06 · 96 阅读 · 0 评论 -
10.23 test1 T1+数论模版
数论原创 2018-10-31 09:46:34 · 145 阅读 · 0 评论 -
POJ 3250单调栈模版+题目清单
https://blog.csdn.net/zuzhiang/article/details/78134247http://poj.org/problem?id=3250#include&lt;iostream&gt;#include&lt;cstdio&gt;#include&lt;cstring&gt;#include&lt;algorithm&gt;#原创 2018-10-30 08:29:52 · 401 阅读 · 0 评论 -
10.30 POJ 3494单调栈
http://poj.org/problem?id=3494https://blog.csdn.net/zuzhiang/article/details/78136417#include&lt;iostream&gt;#include&lt;cstdio&gt;#include&lt;cstring&gt;#include&lt;algorithm&gt;#原创 2018-10-30 11:43:52 · 453 阅读 · 1 评论 -
01字典树题目清单+详解
https://blog.csdn.net/zuzhiang/article/details/79872805转载 2018-11-02 09:49:56 · 564 阅读 · 0 评论 -
01字典树加强版HDU 5536
01字典树加强版HDU 5536http://acm.hdu.edu.cn/showproblem.php?pid=5536简化版题意:在一个数组中找出 (s[i]+s[j])^s[k] 最大的值,其中 i、j、k 各不相同。这个题目我们就不能直接套用模板了,问题出在哪里?是因为i、j、k不能相同,所以直接查询tire树会出现问题。怎么办?一个很直观的想法是删除。对k建trie树,...原创 2018-11-02 09:53:56 · 117 阅读 · 0 评论 -
HDU3507 Bzoj3156 斜率优化dp模板
HDU3507 斜率优化dp模板BZOJ3156原创 2019-08-09 14:20:04 · 138 阅读 · 0 评论