当前你的浏览器版本过低,网站已在兼容模式下运行,兼容模式仅提供最小功能支持,网站样式可能显示不正常。
请尽快升级浏览器以体验网站在线编辑、在线运行等功能。

建议使用的浏览器:

谷歌Chrome 火狐Firefox Opera浏览器 微软Edge浏览器 QQ浏览器 360浏览器 傲游浏览器

3834:Graph Game

题目描述
Consider the following game on an undirected graph G. There are two players, a red color player R and a blue color player B. Initially all edges of G are uncolored. The two players alternately color an uncolored edge of G with their color until all edges are colored. The goal of B is that in the end, the blue-colored edges form a connected spanning subgraph of G. A connected spanning subgraph of G is a connected subgraph that contains all the vertexes of graph G. The goal of R is to prevent B from achieving his goal.

Assume that R starts the game. Suppose that both players play in the smartest way. Your task is to find out whether B will win the game.
输入解释
The input contains several test cases, ended by a line of `-1 -1'.

Each test case begins with a line of two integers n (1 <= n <= 10) and m (0 <= m <= 30), indicating the number of vertexes and edges in the graph. All vertexes are numbered from 0 to n - 1.

Then m lines follow. Each line contains two integers p and q (0 <= p, q < n), indicating there is an edge between vertex p and vertex q.

It is possible that the graph contains more than one edge between two vertexes and self-loops.
输出解释
For each test case print a line which is either 'YES' or 'NO' indicating B will win the game or not.
输入样例
3 4
0 1
1 2
2 0
0 2
4 6
1 0
1 2
2 0
0 2
3 0
1 0
-1 -1
输出样例
YES
NO

该题目是Virtual Judge题目,来自 北京大学POJ

题目来源 Ningbo 2009

源链接: POJ-3834

最后修改于 2020-10-29T07:13:20+00:00 由爬虫自动更新

共提交 0

通过率 --%
时间上限 内存上限
1000 65536