usaco silver 2019 grass planting solution code example
Example: usaco silver 2019 grass planting solution
#include <iostream>
using namespace std;
int N,a,b;
int d[100000];
int main()
{
cin >> N;
for(int i=1;i<N;i++)
{
cin >> a >> b;
d[a-1]++, d[b-1]++;
}
int D = 0;
for(int i=0;i<N;i++)
if(d[i] > D)
D = d[i];
cout << D+1 << '\n';
}