3 Steps(二分图)】的更多相关文章

C - 3 Steps Time limit : 2sec / Memory limit : 256MB Score : 500 points Problem Statement Rng has a connected undirected graph with N vertices. Currently, there are M edges in the graph, and the i-th edge connects Vertices Ai and Bi. Rng will add new…
题目链接 题意 给定一个无向图,\(n\)个点,\(m\)条边(\(n,m\leq 1e5\)). 重复如下操作: 选择相异的两点u,v满足从点u出发走三条边恰好能到达点v.在这样的u,v点对之间添一条边(如果已经存在则无需再次添加). 问最多能添加多少条边. 我的思路 (是写给自己看的读者老爷可以跳过去的部分) 首先, 所有距离为奇数的点对之间都能添边.因为 3-1+3=5 5-1+3=7 5-1+5=9 7-1+3=9 7-1+5=11 7-1+7=13 9-1+3=11 9-1+5=13…
给你一个n个点m条边的无向图,进行以下操作 如果存在两个点u和v,使得从u走三步能恰好到达v,那么在u和v之间连接一条边 重复这个操作直到不能再连接新的边,问最后有多少条边? n, m <= 100000 如果一个连通块包含奇环它一定会变成完全图 如果一个连通块没有奇环,那么它一定是二分图,二分图一定会变成"完全二分图" #include <bits/stdc++.h> using namespace std; #define int long long const…
CODE FESTIVAL 2017 qual B C - 3 Steps 题意:给定一个n个结点m条边的无向图,若两点间走三步可以到,那么两点间可以直接连一条边,已经有边的不能连,问一共最多能连多少条边. 题解:其实我不知道二分图的实际算法,网上有人说这可以看成是否是二分图来做.    有人给出了个性质(没发现>_<):相邻奇数长度的两个点一定能连边 二分图就是一个图的结点分别在两个不相交的集合S,T中,且每条边都在两个集合中.(不严谨说法)如果是二分图,那么能连的边数就是|S|*|T|-m…
Going Home Time Limit: 1000MS   Memory Limit: 65536K Total Submissions: 22088   Accepted: 11155 Description On a grid map there are n little men and n houses. In each unit time, every little man can move one unit step, either horizontally, or vertica…
POJ 2195 Going Home (带权二分图匹配) Description On a grid map there are n little men and n houses. In each unit time, every little man can move one unit step, either horizontally, or vertically, to an adjacent point. For each little man, you need to pay a…
Going Home Time Limit: 1000MS Memory Limit: 65536K Total Submissions: 24716 Accepted: 12383 Description On a grid map there are n little men and n houses. In each unit time, every little man can move one unit step, either horizontally, or vertically,…
Going Home Description On a grid map there are n little men and n houses. In each unit time, every little man can move one unit step, either horizontally, or vertically, to an adjacent point. For each little man, you need to pay a $1 travel fee for e…
传送门:http://poj.org/problem?id=2195 Going Home Time Limit: 1000MS   Memory Limit: 65536K Total Submissions: 26151   Accepted: 13117 Description On a grid map there are n little men and n houses. In each unit time, every little man can move one unit st…
http://acm.hdu.edu.cn/showproblem.php?pid=1533 Going Home Problem Description   On a grid map there are n little men and n houses. In each unit time, every little man can move one unit step, either horizontally, or vertically, to an adjacent point. F…