AtCoder Beginner Contest 223
G
Vertex Deletion
AtCoder
⌀ 2351
原题
←H →
翻译中…

Problem Statement

翻译中…

Given is a tree with $N$ vertices. The vertices are numbered $1,2,\ldots,N$, and the $i$-th edge $(1 \leq i \leq N-1)$ connects Vertex $u_i$ and Vertex $v_i$.

翻译中…

Find the number of integers $i$ $(1 \leq i \leq N)$ that satisfy the following condition.

翻译中…
  • The size of the maximum matching of the graph obtained by deleting Vertex $i$ and all incident edges from the tree is equal to the size of the maximum matching of the original tree.
翻译中…

Constraints

翻译中…
  • $2 \leq N \leq 2 \times 10^5$
  • $1 \leq u_i < v_i \leq N$
  • The given graph is a tree.
  • All values in input are integers.
翻译中…

Input

翻译中…

Input is given from Standard Input in the following format:

翻译中…

N
u_1 v_1
u_2 v_2
\vdots
u_{N-1} v_{N-1}

翻译中…

Output

翻译中…

Print the answer.

翻译中…

样例

Input #1
3
1 2
2 3
Output #1
2
The size of the maximum matching of the original tree is $1$. The size of the maximum matching of the graph obtained by deleting Vertex $1$ and all incident edges from the tree is $1$. The size of the maximum matching of the graph obtained by deleting Vertex $2$ and all incident edges from the tree is $0$. The size of the maximum matching of the graph obtained by deleting Vertex $3$ and all incident edges from the tree is $1$. Thus, two integers $i=1,3$ satisfy the condition, so we should print $2$.
Input #2
2
1 2
Output #2
0
Input #3
6
2 5
3 5
1 4
4 5
4 6
Output #3
4
题目信息
题号
abc223_g
时间限制
2 s
内存限制
1024 MB

题面与样例版权归 AtCoder 及出题人所有;中文翻译由 AI 生成(CI 管线),如有出入请以原文为准。