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;

long long 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]);
		long long 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,(int)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]);
			long long 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,(int)e[l].size());
				now*=tot;
			}
			if(mx<ad)
			{
				ad=mx;
				al=now;
			}
			else if(mx==ad)
				al=now;
		}
	printf("%d %lld",ad+1,al);
}

Compiler output:
a.cc: In function 'int main()':
a.cc:66:31: error: no matching function for call to 'min(int&, long long int&)'
   66 |                         al=min(al,now);
      |                            ~~~^~~~~~~~
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:233:5: note: candidate: 'template<class _Tp> constexpr const _Tp& std::min(const _Tp&, const _Tp&)'
  233 |     min(const _Tp& __a, const _Tp& __b)
      |     ^~~
/usr/include/c++/14/bits/stl_algobase.h:233:5: note:   template argument deduction/substitution failed:
a.cc:66:31: note:   deduced conflicting types for parameter 'const _Tp' ('int' and 'long long int')
   66 |                         al=min(al,now);
      |                            ~~~^~~~~~~~
/usr/include/c++/14/bits/stl_algobase.h:281:5: note: candidate: 'template<class _Tp, class _Compare> constexpr const _Tp& std::min(const _Tp&, const _Tp&, _Compare)'
  281 |     min(const _Tp& __a, const _Tp& __b, _Compare __comp)
      |     ^~~
/usr/include/c++/14/bits/stl_algobase.h:281: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:5686:5: note: candidate: 'template<class _Tp> constexpr _Tp std::min(initializer_list<_Tp>)'
 5686 |     min(initializer_list<_Tp> __l)
      |     ^~~
/usr/include/c++/14/bits/stl_algo.h:5686:5: note:   candidate expects 1 argument, 2 provided
/usr/include/c++/14/bits/stl_algo.h:5696:5: note: candidate: 'template<class _Tp, class _Compare> constexpr _Tp std::min(initializer_list<_Tp>, _Compare)'
 5696 |     min(initializer_list<_Tp> __l, _Compare __comp)
      |     ^~~
/usr/include/c++/14/bits/stl_algo.h:5696:5: note:   template argument deduction/substitution failed:
a.cc:66:31: note:   mismatched types 'std::initializer_list<_Tp>' and 'int'
   66 |                         al=min(al,now);
      |                            ~~~^~~~~~~~