Language: C++

#include<cstdio>
#include<iostream>
#include<cstring>
#include<algorithm>
#include<vector>
using namespace std;

const int N=1e5+1e3+7;

int n;

vector<int>e[N];

int dep[N],lf[N];

int ad,al;

void dfs(int i,int f)
{
	for(int j=0;j<e[i].size();j++)
	{
		int v=e[i][j];
		if(v==f)
			continue;
		dep[v]=dep[i]+1;
		dfs(v,i);
	}
}

int main()
{
	scanf("%d",&n);
	for(int i=1;i<n;i++)
	{
		int u,v;
		scanf("%d%d",&u,&v);
		e[u].push_back(v);
		e[v].push_back(u);
	}
	int ad=0x7fffffff,al=0x7fffffff;
	for(int i=1;i<=n;i++)
	{
		for(int t=1;t<=n;t++)
			lf[t]=0,dep[t]=0;
		dfs(i,0);
		int mx=0;
		for(int j=1;j<=n;j++)
			mx=max(mx,dep[j]);
		int now=1;
		for(int j=0;j<mx;j++)
		{
			int tot=0;
			for(int k=1;k<=n;k++)
				if(dep[k]==j)
					tot=max(tot,e[k].size());
			now*=tot;
		}
		if(mx<ad)
		{
			ad=mx;
			al=now;
		}
		else if(mx==ad)
			al=min(al,now);
	}
	for(int i=1;i<=n;i++)
		for(int j=0;j<e[i].size();j++)
		{
			for(int t=1;t<=n;t++)
				lf[t]=0,dep[t]=0;
			int v=e[i][j];
			if(i>v)
				continue;
			dfs(i,v);
			dfs(v,i);
			int mx=0;
			for(int k=1;k<=n;k++)
				mx=max(mx,dep[k]);
			int now=1;
			for(int k=0;k<mx;k++)
			{
				int tot=0;
				for(int l=1;l<=n;l++)
					if(dep[l]==k)
						tot=max(tot,e[l].size());
				now*=tot;
			}
			if(mx<ad)
			{
				ad=mx;
				al=now;
			}
			else if(mx==ad)
				al=now;
		}
	printf("%d %d",ad+1,al);
}

Compiler output:
a.cc: In function 'int main()':
a.cc:55:48: error: no matching function for call to 'max(int&, std::vector<int>::size_type)'
   55 |                                         tot=max(tot,e[k].size());
      |                                             ~~~^~~~~~~~~~~~~~~~~
In file included from /usr/include/c++/14/string:51,
                 from /usr/include/c++/14/bits/locale_classes.h:40,
                 from /usr/include/c++/14/bits/ios_base.h:41,
                 from /usr/include/c++/14/ios:44,
                 from /usr/include/c++/14/ostream:40,
                 from /usr/include/c++/14/iostream:41,
                 from a.cc:2:
/usr/include/c++/14/bits/stl_algobase.h:257:5: note: candidate: 'template<class _Tp> constexpr const _Tp& std::max(const _Tp&, const _Tp&)'
  257 |     max(const _Tp& __a, const _Tp& __b)
      |     ^~~
/usr/include/c++/14/bits/stl_algobase.h:257:5: note:   template argument deduction/substitution failed:
a.cc:55:48: note:   deduced conflicting types for parameter 'const _Tp' ('int' and 'std::vector<int>::size_type' {aka 'long unsigned int'})
   55 |                                         tot=max(tot,e[k].size());
      |                                             ~~~^~~~~~~~~~~~~~~~~
/usr/include/c++/14/bits/stl_algobase.h:303:5: note: candidate: 'template<class _Tp, class _Compare> constexpr const _Tp& std::max(const _Tp&, const _Tp&, _Compare)'
  303 |     max(const _Tp& __a, const _Tp& __b, _Compare __comp)
      |     ^~~
/usr/include/c++/14/bits/stl_algobase.h:303:5: note:   candidate expects 3 arguments, 2 provided
In file included from /usr/include/c++/14/algorithm:61,
                 from a.cc:4:
/usr/include/c++/14/bits/stl_algo.h:5706:5: note: candidate: 'template<class _Tp> constexpr _Tp std::max(initializer_list<_Tp>)'
 5706 |     max(initializer_list<_Tp> __l)
      |     ^~~
/usr/include/c++/14/bits/stl_algo.h:5706:5: note:   candidate expects 1 argument, 2 provided
/usr/include/c++/14/bits/stl_algo.h:5716:5: note: candidate: 'template<class _Tp, class _Compare> constexpr _Tp std::max(initializer_list<_Tp>, _Compare)'
 5716 |     max(initializer_list<_Tp> __l, _Compare __comp)
      |     ^~~
/usr/include/c++/14/bits/stl_algo.h:5716:5: note:   template argument deduction/substitution failed:
a.cc:55:48: note:   mismatched types 'std::initializer_list<_Tp>' and 'int'
   55 |                                         tot=max(tot,e[k].size());
      |                                             ~~~^~~~~~~~~~~~~~~~~
a.cc:85:56: error: no matching function for call to 'max(int&, std::vector<int>::size_type)'
   85 |                                                 tot=max(tot,e[l].size());
      |                                                     ~~~^~~~~~~~~~~~~~~~~
/usr/include/c++/14/bits/stl_algobase.h:257:5: note: candidate: 'template<class _Tp> constexpr const _Tp& std::max(const _Tp&, const _Tp&)'
  257 |     max(const _Tp& __a, const _Tp& __b)
      |     ^~~
/usr/include/c++/14/bits/stl_algobase.h:257:5: note:   template argument deduction/substitution failed:
a.cc:85:56: note:   deduced conflicting types for parameter 'const _Tp' ('int' and 'std::vector<int>::size_type' {aka 'long unsigned int'})
   85 |                                                 tot=max(tot,e[l].size());
      |                                                     ~~~^~~~~~~~~~~~~~~~~
/usr/include/c++/14/bits/stl_algobase.h:303:5: note: candidate: 'template<class _Tp, class _Compare> constexpr const _Tp& std::max(const _Tp&, const _Tp&, _Compare)'
  303 |     max(const _Tp& __a, const _Tp& __b, _Compare __comp)
      |     ^~~
/usr/include/c++/14/bits/stl_algobase.h:303:5: note:   candidate expects 3 arguments, 2 provided
/usr/include/c++/14/bits/stl_algo.h:5706:5: note: candidate: 'template<class _Tp> constexpr _Tp std::max(initializer_list<_Tp>)'
 5706 |     max(initializer_list<_Tp> __l)
      |     ^~~
/usr/include/c++/14/bits/stl_algo.h:5706:5: note:   candidate expects 1 argument, 2 provided
/usr/include/c++/14/bits/stl_algo.h:5716:5: note: candidate: 'template<class _Tp, class _Compare> constexpr _Tp std::max(initializer_list<_Tp>, _Compare)'
 5716 |     max(initializer_list<_Tp> __l, _Compare __comp)
      |     ^~~
/usr/include/c++/14/bits/stl_algo.h:5716:5: note:   template argument deduction/substitution failed:
a.cc:85:56: note:   mismatched types 'std::initializer_list<_Tp>' and 'int'
   85 |                                                 tot=max(tot,e[l].size());
      |                                                     ~~~^~~~~~~~~~~~~~~~~