2262021-03-05 10:38:35mraronÁtvágás (75 pont)cpp14Accepted 75/75145ms9684 KiB
#include<bits/stdc++.h>
using namespace std;
int main() {
	int n;
	cin>>n;
	vector<int> fok(n+1);
	for(int i=1;i<n;++i) {
		int a,b;
		cin>>a>>b;
		fok[a]++;
		fok[b]++;
	}
	
	int to_bamboo=0, to_star=1e9;
	for(int i=1;i<=n;++i) {
		to_bamboo+=max(0,fok[i]-2);
		to_star=min(to_star, n-1-fok[i]);
	}
	
	cout<<to_bamboo<<" "<<to_star<<"\n";
	return 0;
}
SubtaskSumTestVerdictTimeMemory
base75/75
1Accepted0/02ms1736 KiB
2Accepted0/01ms1764 KiB
3Accepted0/06ms1996 KiB
4Accepted4/41ms1928 KiB
5Accepted4/41ms1928 KiB
6Accepted4/41ms1940 KiB
7Accepted4/41ms1940 KiB
8Accepted4/41ms1944 KiB
9Accepted4/41ms1944 KiB
10Accepted4/4122ms5004 KiB
11Accepted4/4119ms6912 KiB
12Accepted4/4133ms9296 KiB
13Accepted4/4129ms9676 KiB
14Accepted4/4142ms9668 KiB
15Accepted4/4138ms9672 KiB
16Accepted4/4131ms9684 KiB
17Accepted4/4145ms9676 KiB
18Accepted5/5126ms9684 KiB
19Accepted6/6125ms9672 KiB
20Accepted6/6126ms9668 KiB
21Accepted2/21ms8168 KiB