Problem Description This year is the 60th anniversary of NJUST, and to make the celebration more colorful, Tom200 is going to invite distinguished alumnus back to visit and take photos. After carefully planning, Tom200 announced his activity plan…
The Accomodation of Students Time Limit: 5000/1000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Others)Total Submission(s): 5225 Accepted Submission(s): 2374 Problem Description There are a group of students. Some of them may know each ot…
Problem Description Soda has a bipartite graph with n vertices and m undirected edges. Now he wants to make the graph become a complete bipartite graph with most edges by adding some extra edges. Soda needs you to tell him the maximum number of edges…
-->Lake Counting 直接上中文了 Descriptions: 由于近日阴雨连天,约翰的农场中中积水汇聚成一个个不同的池塘,农场可以用 N x M (1 <= N <= 100; 1 <= M <= 100) 的正方形来表示.农场中的每个格子可以用'W'或者是'.'来分别代表积水或者土地,约翰想知道他的农场中有多少池塘.池塘的定义:一片相互连通的积水.任何一个正方形格子被认为和与它相邻的8个格子相连. 给你约翰农场的航拍图,确定有多少池塘 Input Line 1…
链接: https://vjudge.net/problem/CodeForces-687A 题意: Recently, Pari and Arya did some research about NP-Hard problems and they found the minimum vertex cover problem very interesting. Suppose the graph G is given. Subset A of its vertices is called a v…
题目链接:http://code-festival-2017-qualb.contest.atcoder.jp/tasks/code_festival_2017_qualb_c 题意:给出一个含 n 个顶点 m 条边的图,对于图中两点 u, v 之间可以添加一条边当且仅当 u, v 是通过三条边连接在一起时,求最多可以添加多少条边. 思路:猜结论,当给出的图是二分图时,sol = st1.size() * st2.size() - m,其中 st1.size(), st2.size() 二分图两…
#include <cstring> #include <iostream> #include <algorithm> using namespace std; , M = ; int n, m; int h[N], e[M], ne[M], idx; int color[N]; void add(int a, int b) { e[idx] = b, ne[idx] = h[a], h[a] = idx ++ ; } bool dfs(int u, int c) {…