45442023-03-29 14:05:15MatematikaÁtvágás (75 pont)cpp17Partially correct 71/75142ms5240 KiB
// Source: https://usaco.guide/general/io

#include <bits/stdc++.h>
using namespace std;

int main() {
	int n, be, be2, bambusz=0, csillag=0;
	cin >> n;
	vector<int> vec(n);
	for(int i=0; i<n-1; i++)
	{
		cin >> be >> be2;
		vec[be]++;
		vec[be2]++;
	}
	for(int i=0; i<n; i++)
	{
		if(vec[i]>csillag)
		{
			csillag=vec[i];
		}
	}
	csillag=n-1-csillag;
	for(int i=0; i<n; i++)
	{
		vec[i]=vec[i]-2;
		if(vec[i]<0)
		{
			vec[i]=0;
		}
		bambusz=bambusz+vec[i];
		
	}
	cout << bambusz << " " << csillag;
}
SubtaskSumTestVerdictTimeMemory
base71/75
1Accepted0/03ms1816 KiB
2Accepted0/03ms2200 KiB
3Accepted0/08ms2436 KiB
4Accepted4/43ms2556 KiB
5Accepted4/43ms2768 KiB
6Accepted4/42ms2848 KiB
7Accepted4/43ms2740 KiB
8Partially correct2/43ms2760 KiB
9Partially correct2/43ms2852 KiB
10Accepted4/4108ms4332 KiB
11Accepted4/4119ms4400 KiB
12Accepted4/4130ms4760 KiB
13Accepted4/4135ms4700 KiB
14Accepted4/4135ms4680 KiB
15Accepted4/4136ms4900 KiB
16Accepted4/4136ms4952 KiB
17Accepted4/4142ms5048 KiB
18Accepted5/5136ms5240 KiB
19Accepted6/6135ms5172 KiB
20Accepted6/6135ms5172 KiB
21Accepted2/23ms3820 KiB