Question:
N vertices and m undirected Edges
Returns an homogeneous subgraph that contains at least m edges and is a bipartite graph.
Output X point set and Y point set of the Bipartite Graph
Ideas:
Non-Positive Solution
We can randomly generate a group of solutions first, and then determine whether the group of solutions is feasible (the estimated feasible solution space is large)
# Include
# Include
Using namespace std; # define N 105 bool s [N]; int n, m; int Stack [N], top, nowlen; struct node {int u, v ;} edge [10096]; int edgenum; void put (bool hehe) {top = 0; for (int I = 1; I <= n; I ++) if (s [I] = hehe) Stack [top ++] = I; printf (% d, top); if (top) sort (Stack, Stack + top ); while (top --) printf (% d, Stack [top]); printf () ;}int main () {int T, I; scanf (% d, & T ); while (T --) {edgenum = nowlen = 0; scanf (% d, & n, & m); for (I = 0; I <m; I ++) {scanf (% d, & edge [edgenum]. u, & edge [edgenum]. v); edgenum ++;} while (nowlen