CF1949C Annual Ants' Gathering

题目描述

### 题面描述 给定一棵 $n$ 个点的树,每个点的初始点权为 1。你可以将一个点 $u$ 的点权转到点 $v$ 当且仅当 $u$ 的点权小于等于 $v$ 的点权。问是否可以通过若干次操作使一个点的点权为 $n$,即将所有点的点权集中在一个点上。

输入格式

第 $1$ 行是树的大小 $n$,第 $2$ 行开始有 $n-1$ 行,每行两个数字 $u,v$,表示对树的描述。

输出格式

一行 YES 或 NO,表示是否能将所有点的点权集中在一个点上。

说明/提示

In the first sample, you can gather all the ants at house $ 3 $ as follows: - You tell to the ant at house $ 4 $ to move to house $ 6 $ . - You tell to the ant at house $ 2 $ to move to house $ 3 $ . - You tell to the two ants at house $ 6 $ to move to house $ 3 $ (which already contains two ants). - You tell to the ant at house $ 5 $ to move to house $ 1 $ . - You tell to the ant at house $ 7 $ to move to house $ 1 $ (which already contains two ants). - You tell to the three ants at house $ 1 $ to move to house $ 3 $ (which already contains four ants). In the second sample, it is impossible to gather all the ants in a single house.