上一页 1 ··· 16 17 18 19 20 21 22 23 24 ··· 29 下一页
摘要: https://www.luogu.org/problemnew/show/P4452 又一道看题解的费用流。 注意时间也影响节点,像题解那样建边就少很多了。 阅读全文
posted @ 2019-03-29 09:48 韵意 阅读(231) 评论(0) 推荐(0) 编辑
摘要: #include using namespace std; const int MAXN=10000; const int MAXM=100000; const int INF=0x3f3f3f3f; struct Edge{ int to,next,cap,flow,cost; }edge[MAXM]; int head[MAXN],tol; int pre[MAXN],dis[MA... 阅读全文
posted @ 2019-03-29 08:45 韵意 阅读(218) 评论(0) 推荐(0) 编辑
摘要: 第一次做最小割,不是很理解。 https://www.luogu.org/problemnew/show/P1361 要把东西分进两类里,好像可以应用最小割的模板,其中一类A作为源点,另一类B作为汇点,价值就是边的容量。 然后最小割一定会割断每个中间结点的两边的其中一边,这样最大价值就顺带求出来了。 阅读全文
posted @ 2019-03-28 23:33 韵意 阅读(166) 评论(0) 推荐(0) 编辑
摘要: http://old.orzsiyuan.com/articles/algorithm-Network-Flow-Minimum-Cut/ 阅读全文
posted @ 2019-03-28 23:02 韵意 阅读(138) 评论(0) 推荐(0) 编辑
摘要: https://scut.online/p/48 一道二分图匹配,跑费用流就可以过了(其实最大流都可以了)。 洛谷上的居然要求出是哪些边。 那就根据自己丰富的编程经验瞎搞一发。 阅读全文
posted @ 2019-03-28 22:46 韵意 阅读(201) 评论(0) 推荐(0) 编辑
摘要: https://scut.online/p/254 思路很清晰,写起来很恶心。 阅读全文
posted @ 2019-03-28 13:21 韵意 阅读(133) 评论(0) 推荐(0) 编辑
摘要: 因为昨天在Codeforces上设计的区间dp错了(错过了上紫的机会),觉得很难受。看看学长好像也有学,就不用看别的神犇的了。 区间dp处理环的时候可以把序列延长一倍。 下面是 $O(n^3)$ 的朴素区间dp: 下面是四边形优化的 $O(n^2)$ 区间dp: 首先,使用四边形优化要满足下面的性质 阅读全文
posted @ 2019-03-27 01:34 韵意 阅读(183) 评论(0) 推荐(0) 编辑
摘要: 模板题啦。 虽然Prim在解决某些特殊情形时有用,但一般Kruskal就够了。 阅读全文
posted @ 2019-03-25 15:23 韵意 阅读(110) 评论(0) 推荐(0) 编辑
摘要: https://codeforces.com/gym/101982/attachments K 打表暴力 /*#include<bits/stdc++.h> using namespace std; map<int,double> dmin,dmax; bool legal(int n){ int 阅读全文
posted @ 2019-03-25 00:44 韵意 阅读(674) 评论(0) 推荐(0) 编辑
摘要: 新东西: 求$\sum\limits_{i=1}^{n}|\mu(i)|$ 根据莫比乌斯函数的性质,实际上就是求$\sum\limits_{i=1}^{\lfloor\sqrt{n}\rfloor}\mu(i)*\lfloor\frac{n}{i*i}\rfloor$ 根据DQ大佬的提示,我们要求的 阅读全文
posted @ 2019-03-24 15:42 韵意 阅读(351) 评论(0) 推荐(0) 编辑
摘要: http://codeforces.com/gym/101982/attachments/download/7897/20182019 acmicpc pacific northwest regional contest div 1 en.pdf include using namespace st 阅读全文
posted @ 2019-03-24 13:43 韵意 阅读(154) 评论(0) 推荐(0) 编辑
摘要: 第一次用Markdown编辑器写博文呢。 单源最短路的模板,链式前向星写法。 非负权的单源最短路Dijkstra算法。 Dijkstra cpp include using namespace std; const int INF=0x3f3f3f3f; / begin 链式前向星 / const 阅读全文
posted @ 2019-03-21 22:41 韵意 阅读(170) 评论(0) 推荐(0) 编辑
摘要: 啊啊 阅读全文
posted @ 2019-03-19 00:13 韵意 阅读(95) 评论(0) 推荐(0) 编辑
摘要: 欧拉定理: $a^{\varphi(m)}=1\ mod\ m$ 当 $a,m$ 互质的时, 所以 $a^{c}=a^{c\ mod\ \varphi(m)}\ mod\ m$ 可以用来化简幂次,比如求 $7^{222}\ mod\ 10$ 因为7和10互质,求出 $\varphi(10)=4$ 则 阅读全文
posted @ 2019-03-18 21:49 韵意 阅读(199) 评论(0) 推荐(0) 编辑
摘要: 传说中的大名鼎鼎的DJB哈希(谐音?) 配套一个map使用就可以了,碰撞概率很低。 阅读全文
posted @ 2019-03-18 21:40 韵意 阅读(99) 评论(0) 推荐(0) 编辑
上一页 1 ··· 16 17 18 19 20 21 22 23 24 ··· 29 下一页