摘要: namespace NF{ int last[maxn], dep[maxn], ecnt = 1; struct edge{int y, gg, w;} e[maxm<<2]; inline void addedge(int x, int y, int w){ e[++ecnt].y = y; e 阅读全文
posted @ 2021-02-24 17:38 zimindaada 阅读(74) 评论(0) 推荐(0) 编辑
摘要: 复杂度:期望 \(O(\text{MR_TIME} \times n ^ {\frac{1}{4}})\), 当 MR_TIME 越大越正确 const int MR_TIME = 20; bool Miller_Rabin(ll x){ if(x == 1) return 0; if(x == 2 阅读全文
posted @ 2021-02-24 16:07 zimindaada 阅读(84) 评论(0) 推荐(0) 编辑
摘要: 权值线段树 权值线段树 和 普通线段树 别无二致,只不过 普通线段树非叶节点维护 \([a_l, a_r]\) 的信息,其每个非叶节点维护的是值为 \([l,r]\) 的信息。如果不理解的话,可以看看下面用 权值线段树 维护 \(a\) 数组每个数出现的个数 的例子(当然我们得假设已知 \(1 \l 阅读全文
posted @ 2021-02-24 15:34 zimindaada 阅读(267) 评论(0) 推荐(2) 编辑