题意:给你一张DAG,让你选取最多的点,使得这些点之间互相不可达. 思路:此问题和最小路径可重复点覆盖等价,先在原图上跑一边传递闭包,然后把每个点拆成两个点i, i + n, 原图中的边(a, b)变成(a, b + n),跑一变网络流, 答案就是n - maxflow; 代码: #pragma GCC optimize(3) #pragma GCC optimize("Ofast") #pragma GCC optimize("inline") #pragma G…
题目描述 In this problem, we would like to talk about unreachable sets of a directed acyclic graph G = (V, E). In mathematics a directed acyclic graph (DAG) is a directed graph with no directed cycles. That is a graph such that there is no way to start a…
题意: 找出不能相互访问的点集的集合的元素数量. 思路: 偏序集最长反链裸题. 代码: #include<iostream> #include<cstring> using namespace std; ; int g[maxn][maxn]; int uN,vN; int linker[maxn]; bool used[maxn]; bool dfs(int u) { ; v < vN; v++) if(g[u][v] && !used[v]) { used…
题目链接 https://nanti.jisuanke.com/t/19979 题意 给出n个点 m 条边 求选出最大的点数使得这个点集之间 任意两点不可达 题目中给的边是有向边 思路 这道题 实际上是求 二分图的最大独立集 二分图的最大独立集 = 顶点数 - 二分图最大匹配 相关概念: https://blog.csdn.net/whosemario/article/details/8513836 那操作就是 先Flyod 跑出 可达矩阵 再二分匹配 答案就是 n - res AC代码 #pr…
题目链接:https://nanti.jisuanke.com/t/19979 题意:给出一个 n 个点,m 条边的 DAG,选出最大的子集使得其中结点两两不能到达. 题解:参考自:https://blog.csdn.net/winter2121/article/details/79849472     首先用弗洛伊德跑出一个可达性矩阵,然后从每个点开始 dfs 跑二分图,则最后 dfs 出的路径为若干条链,而对于链显然除了最后一个结点,其他结点都要删除,而其他结点的总数即跑二分图的匹配数,用总…
In this problem, we will define a graph called star graph, and the question is to find the minimum distance between two given nodes in the star graph. Given an integer nnn, an n−dimensionaln-dimensionaln−dimensional star graph, also referred to as Sn…
There are nnn rectangles on the plane. The problem is to find the area of the union of these rectangles. Note that these rectangles might overlap with each other, and the overlapped areas of these rectangles shall not be counted more than once. For e…
Let SSS be a sequence of integers s1s_{1}s​1​​, s2s_{2}s​2​​, ........., sns_{n}s​n​​ Each integer is is associated with a weight by the following rules: (1) If is is negative, then its weight is 000. (2) If is is greater than or equal to 10000100001…
You are given a list of train stations, say from the station 111 to the station 100100100. The passengers can order several tickets from one station to another before the train leaves the station one. We will issue one train from the station 111 to t…
https://www.cnblogs.com/2462478392Lee/p/11650548.html https://www.cnblogs.com/2462478392Lee/p/11650154.html https://www.cnblogs.com/2462478392Lee/p/11648061.html…