Game

TimeLimit: 2000/1000 MS (Java/Others)  MemoryLimit: 32768/32768 K (Java/Others)
64-bit integer IO format:%I64d
未提交 | 登录后收藏
Problem Description
  Flynn and oooccc1 are playing game some day. The game is played on a rooted graph which is an undirected graph with every edge attached by some path to a special vertex called the root or the ground. The ground is denoted in the figure that follows by a dotted line. You could see it from the figure.



  On each step, one player could chop out one edge, and removing that edge and anything not connected to the ground. The one who have nothing to chop with fails.
  Flynn is the one who is going to move. Help him by telling him if it is possible to win by carefully choose the edge to chop with.
Input
There are a few cases. Process to the end of file
Each case starts with N (1 <= N <= 1000) stand for the number of points.
The next line give N numbers, the i-th (i = 0 … N-1) of which represents its father nodes. The root nodes was the one with value -1.
Output
Print “YES” if could win if play optimally, and “NO” otherwise.
SampleInput
8
-1 1 2 2 -1 5 6 6
SampleOutput
NO
Submit
题目统计信息详细
总AC数4
通过人数4
尝试人数5
总提交量6
AC率66.67%
AC该题后可以添加标签
贴完标签可以获得20ACB。
并且可以获得本题所有提交代码查看权限。
点击标题可以显示标签。
如果你还没认真思考过这题,请不要查看标签
如果您已经通过了该题,请务为该题贴上标签

T^T Online Judge

[BUG反馈] [FAQ] [闽ICP备17026590号-1]
当前版本:3.24 系统时间: