随笔分类 -  _模板

摘要:"ref" cpp include include using namespace std; typedef long long ll; int n, a[270005], b[270005], c[270005], rev[270005]; const int mod=998244353, gg= 阅读全文
posted @ 2018-06-07 17:12 poorpool 阅读(189) 评论(0) 推荐(0)
摘要:graham扫描法,参考 "yyb" cpp include include include include using namespace std; int n, din; const double eps=1e 7; struct Point{ double x, y; Point(double 阅读全文
posted @ 2018-05-27 19:26 poorpool 阅读(118) 评论(0) 推荐(0)
摘要:"hihocoder系列" 这是一个系列讲解,好康的,有六集…… 构建SAM并求不同子串数 对应第二个讲解 cpp include include include using namespace std; typedef long long ll; int tot, n, maxLen[200000 阅读全文
posted @ 2018-05-15 19:20 poorpool 阅读(150) 评论(0) 推荐(0)
摘要:k d tree + 重构的思想,就能卡过luogu和bzoj啦orz cpp include include include using namespace std; int n, m, rot, nowD, opt, uu, vv, ans, rub[1000005], din, cur; co 阅读全文
posted @ 2018-04-26 08:53 poorpool 阅读(167) 评论(0) 推荐(0)
摘要:欲学矩阵树定理~~必先自宫~~学习 "一些行列式的姿势" 然后 "做一道例题" 阅读全文
posted @ 2018-04-19 15:24 poorpool 阅读(114) 评论(0) 推荐(0)
摘要:参考资料 "picks" "miskcoo" "menci" "胡小兔" "unname" "自为风月马前卒" 上面是FFT的,学完了就来看 "NTT" 吧 "原根" 例题:luogu3803 fft优化后模板 cpp include include include using namespace 阅读全文
posted @ 2018-04-09 16:19 poorpool 阅读(255) 评论(0) 推荐(0)
摘要:参见 "这里" cpp include include include using namespace std; int n, a[305][305], mat[305], exu[305], exv[305], qiw[305]; const int oo=0x3f3f3f3f; bool viu 阅读全文
posted @ 2018-03-17 20:51 poorpool 阅读(159) 评论(1) 推荐(0)
摘要:BSGS 算法,即 Baby Step,Giant Step 算法、~~拔山盖世~~算法。 计算 $a^x \equiv b \pmod p$。 $p$为质数时 特判掉 $a,p$ 不互质的情况。 由于费马小定理 $x^{p 1} \equiv 1 \pmod p$ 当 $p$ 为质数,则要是暴力的 阅读全文
posted @ 2018-03-05 21:44 poorpool 阅读(184) 评论(0) 推荐(0)
摘要:怎样求同余方程组?如: $$\begin{cases} x \equiv a_1 \pmod {m_1} \\ x \equiv a_2 \pmod {m_2} \\ \cdots \\ x \equiv a_n \pmod {m_n} \end{cases}$$ 不保证 $m$ 两两互素? 两两合 阅读全文
posted @ 2018-03-05 16:56 poorpool 阅读(168) 评论(0) 推荐(0)
摘要:题目: "poj1151" 建议先参考参考别的扫描线文档。 考虑这样一些矩形: 拿一根扫描线从左往右扫,扫描线被矩形覆盖的长度会变化当扫过矩形的左右边界时。 我们就剥离出来左右边界。我们把所有的 $y$ 值都保存下来离散化。 我们拿线段树维护扫描线。线段树结点应保存从第几个 $y$ 开始到第几个 $ 阅读全文
posted @ 2018-02-22 17:47 poorpool 阅读(224) 评论(0) 推荐(0)
摘要:关于空间,第零棵树是 $4n$,其后每棵树都要多来 $\log(n)$ 的空间,所以我是开 $n(4+\log(n))$ 的空间。 关于借用节点: 图片来自 "这里" cpp include include include using namespace std; int n, m, rot[200 阅读全文
posted @ 2018-01-18 16:43 poorpool 阅读(175) 评论(0) 推荐(0)
摘要:"ref" and 挑战程序设计竞赛。 ~~主要是发现自己以前写得代码太难看而且忘光了,而且我字符串死活学不会啊,kmp这种东西我都觉得是省选+难度啊QAQ~~ cpp include include include using namespace std; int n, cnt[1000005], 阅读全文
posted @ 2018-01-09 16:55 poorpool 阅读(201) 评论(5) 推荐(0)
摘要:```cpp include include include include using namespace std; int n, m, uu, vv, ww, a[105], cnt, hea[10005], gra[10005], siz[10005]; int tot, sze, rot; 阅读全文
posted @ 2018-01-07 20:04 poorpool 阅读(167) 评论(0) 推荐(0)
摘要:强烈推荐 "这篇文章" ,一下子就看懂AC了。 cpp include include include using namespace std; typedef long long ll; struct Edge{ int too, nxt; }edge[200005]; int n, m, r, 阅读全文
posted @ 2017-12-29 21:08 poorpool 阅读(475) 评论(8) 推荐(0)
摘要:扩展欧拉定理: $$ a^x \equiv a^{x\mathrm{\ mod\ }\varphi(p) + x \geq \varphi(p) ? \varphi(p) : 0}(\mathrm{\ mod\ }p)$$ cpp include include include using name 阅读全文
posted @ 2017-12-28 21:58 poorpool 阅读(458) 评论(0) 推荐(0)
摘要:$$\sum a_i x\times \sum b_i $$ 等同于 $$ \sum(a_i x \times b_i) $$ 阅读全文
posted @ 2017-12-28 09:05 poorpool 阅读(115) 评论(1) 推荐(0)
摘要:luogu 匈牙利算法 cpp include include include using namespace std; int n, m, uu, vv, e, lnk[1005], ans; bool a[1005][1005], vis[1005]; bool dfs(int u){ for( 阅读全文
posted @ 2017-12-21 21:01 poorpool 阅读(173) 评论(0) 推荐(0)
摘要:每次选代价最小的流增广 cpp include include include include using namespace std; struct Edge{ int too, nxt, val, cst; }edge[100005]; int n, m, ss, tt, maxFlow, mi 阅读全文
posted @ 2017-12-21 19:39 poorpool 阅读(114) 评论(3) 推荐(0)
摘要:当前弧优化 cpp include include include include using namespace std; int n, m, ss, tt, hea[10005], cnt, uu, vv, ww, maxFlow, cur[10005]; int lev[10005]; con 阅读全文
posted @ 2017-12-20 19:26 poorpool 阅读(210) 评论(0) 推荐(0)
摘要:练一下最大流 cpp include include include include using namespace std; int n, m, ron[205][205], pre[205], uu, vv, ww, vis[205]; queue d; int ek(){ int maxFlo 阅读全文
posted @ 2017-12-20 11:09 poorpool 阅读(139) 评论(3) 推荐(0)