随笔分类 -  DP:图上dp(树和有向无环图)

摘要:给定一颗树形的网络 叶子结点为汇点 根节点为源点 求最大流量 换根dp: 适用于对于每一个点都要作为根进行一遍dp的题目 #include <iostream> #include <cstdio> #include <cstring> #include <algorithm> #include <c 阅读全文
posted @ 2022-02-09 17:44 __iostream 阅读(26) 评论(0) 推荐(0) 编辑
摘要:给定一个有向无环图,询问每个点可以到达点的数目. void toposort() { for(rint i=1;i<=n;i++) if(!deg[i]) q.push(i); while(!q.empty()) { int x=q.front(); q.pop(); f[x].set(x,1); 阅读全文
posted @ 2022-01-21 20:32 __iostream 阅读(30) 评论(0) 推荐(0) 编辑

点击右上角即可分享
微信分享提示