题目链接: 传送门 Graph Construction Time Limit: 3000MS Memory Limit: 65536K Description Graph is a collection of edges E and vertices V. Graph has a wide variety of applications in computer. There are different ways to represent graph in computer. It can…
题目链接: 题目 Graph Construction Time limit: 3.000 seconds 问题描述 Graph is a collection of edges E and vertices V. Graph has a wide variety of applications in computer. There are different ways to represent graph in computer. It can be represented by adjace…
Description You are to write a program that tries to find an optimal coloring for a given graph. Colors are applied to the nodes of the graph and the only available colors are black and white. The coloring of the graph is called optimal if a maximum…
Pool construction You are working for the International Company for Pool Construction, a construction company whichspecializes in building swimming pools. A new client wants to build several new pool areas.A pool area is a rectangular grid of w × h s…
题意: 给一个h*w的矩阵,每个格子中是'#'和'.'两个符号之一,分别代表草和洞.现在要将洞给围起来(将草和洞分离),每条边需花费b元(即将一个洞包起来需要4边,将2个连续的洞包起来需要6边,省了2条边).有个特殊能力,能将洞变成草,花费f.当然也能将草变成洞,花费d.围起洞来需要多少花费.矩阵四周最边边的格子都必须是草,即出现洞就必须转草. 转换:洞--->草--->洞 f d (元/格) 围洞: b元/边. 思路: 如果能够尽量让洞都靠在一起,那肯定是最小花费,因为少了…
题意:图上的点染色,给出的边的两个点不能都染成黑色,问最多可以染多少黑色. 很水的一题,用dfs回溯即可.先判断和当前点相连的点是否染成黑色,看这一点是否能染黑色,能染色就分染成黑色和白色两种情况递归,如果不能就单递归白色. 代码: #include <cstdio> #include <cstring> const int maxn = 110; int cas, v, e, M; bool g[maxn][maxn]; int color[maxn], rec[maxn]; v…