UVa 10004:Bicoloring

题目链接:

http://uva.onlinejudge.org/index.php?option=com_onlinejudge&Itemid=8&category=105

题目类型:搜索

题目:

In 1976 the ``Four Color Map Theorem" was proven with the assistance of a computer. This theorem states that every map can be colored using only four colors, in such a way that no region is colored using the same color as a neighbor region.

Here you are asked to solve a simpler similar problem. You have to decide whether a given arbitrary connected graph can be bicolored. That is, if one can assign colors (from a palette of two) to the nodes in such a way that no two adjacent nodes have the same color. To simplify the problem you can assume:

no node will have an edge to itself.

the graph is nondirected. That is, if a node a is said to be connected to a node b, then you must assume that b is connected to a.

the graph will be strongly connected. That is, there will be at least one path from any node to any other node.

题目翻译:

1976年“四色定理”在计算机的帮助下被证明。 这个定理宣告任何一个地图都可以只用四种颜色来填充, 并且没有相邻区域的颜色是相同的。

现在让你解决一个更加简单的问题。 你必须决定给定的任意相连的图能不能够用两种颜色填充。 就是说,如果给其中一个分配一种颜色, 要让所有直接相连的两个节点不能是相同的颜色。 为了让问题更简单,你可以假设:

1. 没有节点是连接向它自己的。

2. 是无向图。  即如果a连接b, 那么b也是连接a的

3. 图是强连接的。就是说至少有一条路径可走向所有节点。

样例输入:

3
3
0 1
1 2
2 0
9
8
0 1
0 2
0 3
0 4
0 5
0 6
0 7
0 8
0

样例输出:

NOT BICOLORABLE.
BICOLORABLE.

分析与总结:

以上是小编为您精心准备的的内容,在的博客、问答、公众号、人物、课程等栏目也有的相关内容,欢迎继续使用右上角搜索按钮进行搜索颜色
, node
, 节点
, 题目
, Connected
The
uva oj、uva和uvb的区别、uvb、uva大学、弗吉尼亚大学,以便于您获取更多的相关知识。

时间: 2024-09-17 04:48:44

UVa 10004:Bicoloring的相关文章

UVa 10004 Bicoloring (DFS&二分图)

10004 - Bicoloring Time limit: 3.000 seconds http://uva.onlinejudge.org/index.php?option=com_onlinejudge&Itemid=8&category=24&page=show_problem&problem=945 In 1976 the ``Four Color Map Theorem" was proven with the assistance of a comp

uva 10004 - Bicoloring

点击打开链接 题目意思:给定n个节点,还有l条边,每一个节点只有两种颜色可以上,但只能选择一种,并且要求相邻的节点之间不能有相同的颜色,判断给定的数据是否满足,如果满足 #include <iostream> #include <cstdio> #include <cstring> #include <queue> using namespace std; const int MAXN = 210; int n , l , flag; int node[MA

UVa 1422:Processor 任务处理问题

题目大意:有n个任务送到处理器处理,每个任务信息包括r,d,w,r代表开始时间,w代表必须要结束的时间,w指需要多少时间处理. 其中处理器的处理速度可以变速,问处理器最小需要多大速度才能完成工作? 输入: 3 5 1 4 2 3 6 3 4 5 2 4 7 2 5 8 1 6 1 7 25 4 8 10 7 10 5 8 11 5 10 13 10 11 13 5 8 15 18 10 20 24 16 8 15 33 11 14 14 1 6 16 16 19 12 3 5 12 22 25

UVa 10905:Children&#039;s Game

题目链接: http://uva.onlinejudge.org/index.php?option=com_onlinejudge&Itemid=8&category=113&page=show_problem&problem=1846 类型: 排序 There are lots of number games for children. These games are pretty easy to play but not so easy to make. We will

UVa 10763:Foreign Exchange

题目链接: http://uva.onlinejudge.org/index.php?option=com_onlinejudge&Itemid=8&category=113&page=show_problem&problem=1704 原题: Your non-profit organization (iCORE - international Confederation of Revolver Enthusiasts) coordinates a very succes

UVa 10341: Solve It

链接: http://uva.onlinejudge.org/index.php?option=com_onlinejudge&Itemid=8&category=113&page=show_problem&problem=1282 原题: Solve the equation:        p*e-x + q*sin(x) + r*cos(x) + s*tan(x) + t*x2 + u = 0        where 0 <= x <= 1. Input

UVa 10057:A mid-summer night&#039;s dream.

链接: http://uva.onlinejudge.org/index.php?option=com_onlinejudge&Itemid=8&category=113&page=show_problem&problem=998 原题: This is year 2200AD. Science has progressed a lot in two hundred years. Two hundred years is mentioned here because thi

UVa 10487:Closest Sums

链接: http://uva.onlinejudge.org/index.php?option=com_onlinejudge&Itemid=8&category=113&page=show_problem&problem=1428 原题: Given is a set of integers and then a sequence of queries. A query gives you a number and asks to find a sum of two di

UVa 10340:All in All

链接: http://uva.onlinejudge.org/index.php?option=com_onlinejudge&Itemid=8&category=113&page=show_problem&problem=1281 原题: You have devised a new encryption technique which encodes a message by inserting between its characters randomly gener