![](https://img-blog.csdnimg.cn/20201014180756919.png?x-oss-process=image/resize,m_fixed,h_64,w_64)
类模板
我的程序跑快快
这个作者很懒,什么都没留下…
展开
-
HihoCoder - 1069(LCA的DFS序+ST表求法,模板)
目前完成了2号结构,可能会爆内存,后面会研究一下原因 代码: // HihoCoder - 1069.cpp /* 一颗树结构求lca: 1.输入一串查询序列,离线Tarjan算法一次算出 2.一次初始化,之后每次查询快速得到答案,压DFS序之后,每次查询区间深度最小值 3.初始化ST表,每次倍增求 */ #include <iostream> #include <st...原创 2019-11-07 11:17:39 · 214 阅读 · 0 评论 -
HihoCoder - 1077(线段树单点修改+区间查询,模板)
代码: #include <iostream> #include <vector> #include <algorithm> using namespace std; class SegmentTree { public: struct node { int val; node() { val = 0; } node(int val) { th...原创 2019-11-04 21:58:55 · 199 阅读 · 0 评论 -
HihoCoder - 1077(拓扑排序,模板)
代码: #include <iostream> #include <vector> #include <queue> using namespace std; struct node { vector<int>u;//出边 int val, in_degree; node() { val = in_degree = 0; u.clea...原创 2019-11-04 19:35:23 · 209 阅读 · 0 评论 -
HihoCoder - 1068(RMQ问题ST表,模板)
题意: 很基础的模板题,但是要封装一个告诉的St表模板类出来,实测效率不低。 代码: // 决定写一个ST表的类,维护区间最小值 #include <iostream> #include <vector> #include <stdio.h> using namespace std; template <class Type> class StLis...原创 2019-11-01 21:26:45 · 212 阅读 · 0 评论 -
HihoCoder - 1421(四叉树,模板)
模板说明: 提供传入vector的构造函数,可高效查询圆形区域的点列表。每块叶子区域点数限制为总数的根号级别。 代码: // HihoCoder - 1421 //Quadtree 叫四叉树,看起来类似于区域线段树 #include <iostream> #include <vector> #include <algorithm> #include <s...原创 2019-11-02 18:52:59 · 282 阅读 · 0 评论 -
HihoCoder - 1066(并查集、模板)
分析: 人名字符串用map映射一下就可以了,这个是一个存储int的并查集,有优化。 代码: #include <iostream> #include <vector> #include <map> using namespace std; class UnionFindSets { public: UnionFindSets(); UnionFindSet...原创 2019-11-02 14:12:02 · 213 阅读 · 0 评论 -
HihoCoder - 1015(KMP匹配,模板)
题意: 封装了一个可KMP匹配的类结构,比较高效。 代码: // HihoCoder - 1015 #include <iostream> #include <string> #include <vector> class ModelString { private: std::string s; std::vector<int> dp; //...原创 2019-11-02 13:09:24 · 191 阅读 · 0 评论