摘要: 字典树 板子题1号, 求某字符串是否出现过及出现几次 AC Code: #include <bits/stdc++.h> using namespace std; const int maxn = 5e5 + 5; int n, m; string s; int trie[maxn][26], to 阅读全文
posted @ 2023-10-31 19:57 hnzzlxs01 阅读(31) 评论(0) 推荐(0)
摘要: 1、描绘路径/图形态,再由此考虑解决方案 2、对于连通性问题,可以简化为一个等价图 3、对于dij,可以由已知的最优状态扩展出未知状态 **4、考虑拆点/分层图 ** 最短路径 Dijkstra算法 求单源最短路 O(m)(稀疏图可用) P4779 【模板】单源最短路径(标准版) 邻接矩阵版本: # 阅读全文
posted @ 2023-09-14 19:53 hnzzlxs01 阅读(36) 评论(0) 推荐(0)
摘要: # 图的存储 ## [图的存储:B3643](https://www.luogu.com.cn/problem/B3643) **AC Code:** ```cpp #include #include #include using namespace std; #define ll long lon 阅读全文
posted @ 2023-09-02 16:36 hnzzlxs01 阅读(65) 评论(0) 推荐(0)
摘要: # 建树: ```cpp int a[100005],d[100005]; void build(int s,int e,int p){// 建树 // 对区间[s,t]建立线段树,当前根编号为p if(s==e){ d[p]=a[s]; return ; } int m=s+((e-s)>>1); 阅读全文
posted @ 2023-09-02 16:35 hnzzlxs01 阅读(56) 评论(0) 推荐(0)