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

建议使用的浏览器:

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

1980:Game!just a game!

题目描述
This game is played by two persons, who are regarded as the Positive player (P player) and the Negative player (N player). There is a graph G=(V, E ) with P vertexs and Q bidirectional edges between the vertexs. Sometimes there are a lot of edges between two vertexs, and all the edges differ from each other. V1 is the first vertex and Vp is the last vertex.

  Everytime P player marks a ‘+’ on one of the remained edges which have neither a ‘+’ nor ‘-‘ at all, and N player marks a ‘-‘ on that kind of edges without any marks. At the beginning, N player acts first, and then P player does, and then N player does alternately. The game comes to an end when all the edges are marked with either a ‘+’ or a ‘-‘.
  Now we give the rules to judge the winner:
1)  If there exists a road from V1 to Vp, whose edges are all marked with ‘+’, P player wins the game ultimately. So we can see, P player tries his best to create a such road to win the game.
2)  If there exists none such road ,whose edges are all marked with ‘+’ from V1 to Vp, P player losses the game finally. Also we can see, N player does the best to destory that kind of roads described above in rule(1).

Now give you such a graph, you need to verdict the result whether the P player can win the game. If true, print “Yes”, or “No”.
输入解释
There are T cases. In the first line of each case, there are two intergers P and Q, P is the number of the vertexs and Q is the number of the edges. Then there come Q lines,each contains two integers v1(1 – P), and v2 ( 1 – P), indicating one edge between the vertex v1 and v2.
  T<=100,2<=P<=30,1<=Q<=1000.
  There is a blank line to separate the adjacent cases.
输出解释
For each case, print the result “Yes” or “No”.
输入样例
2
2 2
1 2
1 2

4 5
1 2
1 3
2 3
2 4
3 4
输出样例
Yes
No
来自杭电HDUOJ的附加信息
Author wangye
Recommend wangye

该题目是Virtual Judge题目,来自 杭电HDUOJ

源链接: HDU-1980

最后修改于 2020-10-25T22:49:29+00:00 由爬虫自动更新

共提交 0

通过率 --%
时间上限 内存上限
9000/3000MS(Java/Others) 32768/32768K(Java/Others)