随笔分类 - 网络流
摘要:洛谷传送门 CF 传送门 要求最大化收益加上支出,又因为每个字符有染红和染蓝两种选择,考虑最小割模型。可以看成是一开始先获得 的收益,然后对于每个 ,连边 ;对于每个 ,连边 \((S, i, r
阅读全文
摘要:[洛谷传送门](https://www.luogu.com.cn/problem/AT_abc317_g "洛谷传送门") [AtCoder 传送门](https://atcoder.jp/contests/abc317/tasks/abc317_g "AtCoder 传送门") 考虑转化成匹配问题
阅读全文
摘要:[洛谷传送门](https://www.luogu.com.cn/problem/CF1525F "洛谷传送门") [CF 传送门](https://codeforces.com/problemset/problem/1525/F "CF 传送门") 套路地,将 DAG 的最小不交路径覆盖转化为点数
阅读全文
摘要:[洛谷传送门](https://www.luogu.com.cn/problem/AT_abc227_h "洛谷传送门") [AtCoder 传送门](https://atcoder.jp/contests/abc227/tasks/abc227_h "AtCoder 传送门") 好奇特的题。 考虑
阅读全文
摘要:[洛谷传送门](https://www.luogu.com.cn/problem/AT_abc225_g "洛谷传送门") [AtCoder 传送门](https://atcoder.jp/contests/abc225/tasks/abc225_g "AtCoder 传送门") 感觉是一种很新的建
阅读全文
摘要:[洛谷传送门](https://www.luogu.com.cn/problem/AT_abc259_g "洛谷传送门") [AtCoder 传送门](https://atcoder.jp/contests/abc259/tasks/abc259_g "AtCoder 传送门") 记 $b_i =
阅读全文
摘要:[洛谷传送门](https://www.luogu.com.cn/problem/AT_abc214_h "洛谷传送门") [AtCoder 传送门](https://atcoder.jp/contests/abc214/tasks/abc214_h "AtCoder 传送门") 好毒瘤啊…… 首先
阅读全文
摘要:[洛谷传送门](https://www.luogu.com.cn/problem/AT_abc193_f "洛谷传送门") [AtCoder 传送门](https://atcoder.jp/contests/abc193/tasks/abc193_f "AtCoder 传送门") 复习一下最小割。
阅读全文
摘要:洛谷传送门 AtCoder 传送门 很棒的 flow 题,考虑建二分图。 源点向每种零食连边权为 的边,每种零食向每个孩子连边权为 的边,每个孩子向汇点连边权为 的边,这个图的最大流就是答案。 直接跑最大流肯定 T,考虑最大流等价于求这个图的最小割,因此转而求最小
阅读全文
摘要:洛谷传送门 CF 传送门 考虑只有一个排列怎么做。有一个结论是答案为 置换环个数,即每个环都会选择一个点不操作,其他点都操作。 接下来考虑两个排列,显然当 在 和 中都不操作, 才能不操作。设 在 中所在环为 ,在 中所
阅读全文
摘要:洛谷传送门 AtCoder 传送门 下文令 。 引理: 一个字符串中本质不同的回文串数量 。 证明: 考虑每在字符串末尾添加一个字符,本质不同回文串数量最多增加 。 考虑反证,设字符串在添加 后, 与 (令
阅读全文
摘要:[AtCoder 传送门](https://atcoder.jp/contests/abc263/tasks/abc263_g "AtCoder 传送门") [洛谷传送门](https://www.luogu.com.cn/problem/AT_abc263_g "洛谷传送门") ## 题意 有 $
阅读全文