hiho week 312 register

Ended

Participants:33

Verdict:Accepted
Score:100 / 100
Submitted:2020-06-21 10:50:48

Lang:G++

Edit
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
#include<bits/stdc++.h>
using namespace std;
int n,m;
const int ma=110000;
vector<int>G[ma];
int f[ma];
int ans=0;
int son[ma];
int dfs(int x,int fa)
{
 
    int sum=0;
    for(int i=0;i<G[x].size();i++)
    {
        int v=G[x][i];
        if(v!=fa)
        {
            f[v]=x;
            son[i]=dfs(v,x);
            sum+=son[i];
        }
    }
    if(sum%2==1)ans++;
    return sum+1;
}
int main()
{
    while(~scanf("%d",&n))
    {
        int u,v;
        memset(son,0,sizeof(son));
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX