HDU 2063
Returns the maximum matching value for a bipartite graph.
Complete bare question. Paste code.
# Include
# Include
# Include
# Include
Using namespace std; vector
G [1005]; bool check [1005]; int mac [1005]; int n; void add_edge (int from, int to) {G [from]. push_back (to); G [to]. push_back (from);} bool dfs (int u) {for (int I = 0; I
HDU 2444
Determines whether the image is a bipartite graph. If it is a bipartite graph, the maximum matching of the graph is obtained.
I used a DFS to determine whether it is a bipartite graph. I don't know if there is any simpler method.
# Include
# Include
# Include
# Include
# Include
# Include
Using namespace std; vector
G [205]; bool check [205]; int mac [205]; int re [205]; void add_edge (int from, int to) {G [from]. push_back (to); G [to]. push_back (from);} bool rdfs (int u, int k) {re [u] = k; bool flag = true; int k1; if (k = 1) k1 = 2; else k1 = 1; for (int I = 0; I
HDU 1281
Question: There are some places on a board that can hold a "car" to find the maximum number of points, and the number of points is the key point. The key point is that deleting the "car" that can be placed at this point will reduce.
Returns the X set column of the row to the Y set. Each point is an edge from the X-Y.
Perform bipartite graph matching. Then enumerate the edge and find the maximum match after deleting this edge. If it is less than before, it is the key point.
#include
#include
#include#include
#include
using namespace std;int mac[205];bool check[205];vector
G[205];int z,y;int n;int k[10005][2];void add_edge(int from,int to){ G[from].push_back(to); G[to].push_back(from);}bool dfs(int u){ for(int i=0;i