上一页 1 ··· 21 22 23 24 25 26 27 28 29 ··· 120 下一页
摘要: 思路很巧妙啊 code: #include <cstdio> #include <cstring> #include <algorithm> #define ll long long #define N 1000009 #define setIO(s) freopen(s".in","r",stdi 阅读全文
posted @ 2020-02-06 16:42 EM-LGH 阅读(201) 评论(0) 推荐(0) 编辑
摘要: 这个题的思路还是十分巧妙的. 我们发现我们要查询的区域恰好构成了一个梯形. 然后用那个单调栈去维护折线,并用主席树做二维数点. code: #include <cstdio> #include <algorithm> #include <stack> #include <cstring> #incl 阅读全文
posted @ 2020-02-06 15:44 EM-LGH 阅读(156) 评论(0) 推荐(0) 编辑
摘要: 显然如果卖出的话肯定要在同一天卖出. 那么我们只需维护 $max(y_{i}\prod x_{i})$ 即可. 乘法维护不了,取一个对数就好了. code: #include <cstdio> #include <cmath> #include <cstring> #include <algorit 阅读全文
posted @ 2020-02-05 14:37 EM-LGH 阅读(129) 评论(0) 推荐(0) 编辑
摘要: 12种组合计数问题合在一起. code: #include <cmath> #include <cstring> #include <algorithm> #include <cstdio> #include <string> #define ll long long #define ull uns 阅读全文
posted @ 2020-02-04 15:04 EM-LGH 阅读(191) 评论(0) 推荐(0) 编辑
摘要: 模板题呀. code: #include <cstdio> #include <cstring> #include <cmath> #include <map> #include <algorithm> #define ll long long #define setIO(s) freopen(s" 阅读全文
posted @ 2020-02-04 10:12 EM-LGH 阅读(118) 评论(0) 推荐(0) 编辑
摘要: 这里讲一下普通的 BSGS 如何实现: 我们要求解形如 $y^x \equiv z(\mod p)$ 的 $x$ 的整数解(其中 $gcd(y,p)=1$) 我们将 $x$ 写成 $am-b$ 的形式,原式就变为 $y^{am} \equiv z \times y^b (\mod p)$ 然后 $b 阅读全文
posted @ 2020-02-04 09:47 EM-LGH 阅读(161) 评论(0) 推荐(0) 编辑
摘要: 这道题很巧妙啊. 有两个性质: 1.一个图的最小生成树的每种边权数量是相等的. 2.有 1 得,如果任意一个最小生成树中边权为 $v$ 的边都断掉,$(x,y)$ 连通性在任意 MST 中都相等. 所以我们的做法就是先求出最小生成树,然后分别将每种边权 $v_{i}$ 从最小生成树中都断掉,得到若干 阅读全文
posted @ 2020-02-03 23:03 EM-LGH 阅读(155) 评论(0) 推荐(0) 编辑
摘要: 矩阵树定理求的是 $\sum_{E} \prod_{e \in E} w(e)$ 平时我们求的大多数是方案数,所以就默认那个 $w(e)$ 是 $1$. 而如果我们想求所有生成树权值之和的话就让那个 $w(e)$ 变成边权. 我们在设置最开始的那个 (度数-邻接)矩阵的时候度数矩阵中 $S1_{i, 阅读全文
posted @ 2020-02-03 21:29 EM-LGH 阅读(126) 评论(0) 推荐(0) 编辑
摘要: 有规律:$f[n]=3 \times f[n-1]-f[n-2]+2$. 由于没有模数,所以需要写一个高精度,这里直接套用的 FFT 板子. code: #include <cstdio> #include <cmath> #include <cstring> #include <algorithm 阅读全文
posted @ 2020-02-03 20:15 EM-LGH 阅读(131) 评论(0) 推荐(0) 编辑
摘要: 求生成树方案的话要用矩阵树定理,然后这个容斥就是常见套路了吧. code: #include <cstring> #include <cstdio> #include <vector> #include <algorithm> #define N 18 #define mod 1000000007 阅读全文
posted @ 2020-02-03 19:10 EM-LGH 阅读(117) 评论(0) 推荐(0) 编辑
上一页 1 ··· 21 22 23 24 25 26 27 28 29 ··· 120 下一页