随笔分类 -  图论 - 01分数规划

摘要:显然取对数,然后二分答案进行 01 分数规划. 设 $f[i][j]$ 表示在 AC 自动机上的点 $i$ ,匹配到了 $j$ 位的最大价值. 转移的时候判断一下当前是点还是数字,然后在 AC 自动机上的终止节点上算一下贡献就行. 构建 AC 自动机的时候要注意:点 $i$ 的价值是 val[i]+ 阅读全文
posted @ 2020-06-09 00:01 EM-LGH 阅读(174) 评论(0) 推荐(0)
摘要:显然01分数规划转成二分答案+判断是否大于 0 的问题. 这个题有一个坑点:不止根节点的父亲可能是 0 号节点(0号节点也是不能省略的) code: #include <cstdio> #include <string> #include <cstring> #include <iostream> 阅读全文
posted @ 2020-01-02 16:23 EM-LGH 阅读(178) 评论(0) 推荐(0)
摘要:code: #include <bits/stdc++.h> using namespace std; #define setIO(s) freopen(s".in","r",stdin) const int N=200006; const double eps=1e-6; const double 阅读全文
posted @ 2019-11-29 18:39 EM-LGH 阅读(160) 评论(0) 推荐(0)