78492024-01-11 13:20:59AblablablaÁtvágás (75 pont)cpp17Accepted 75/75141ms32040 KiB
#include <bits/stdc++.h>

using namespace std;

int main()
{
    int n;
    cin >> n;

    vector<int> befok(n, 0);
    for(int i = 0; i < n - 1; i++){
        int a, b;
        cin >> a >> b;
        a--; b--;

        befok[a]++;
        befok[b]++;
    }

    int bambusz = 0;
    for(int i = 0; i < n; i++){
        bambusz += max(0, befok[i] - 2);
    }

    cout << bambusz << " ";

    int maxi = 0;
    for(int i = 0; i < n; i++){
        maxi = max(maxi, befok[i]);
    }

    cout << n - 1 - maxi << "\n";
}
SubtaskSumTestVerdictTimeMemory
base75/75
1Accepted0/03ms1992 KiB
2Accepted0/03ms2240 KiB
3Accepted0/08ms2612 KiB
4Accepted4/43ms2732 KiB
5Accepted4/43ms2712 KiB
6Accepted4/43ms2784 KiB
7Accepted4/43ms3020 KiB
8Accepted4/43ms3032 KiB
9Accepted4/43ms3264 KiB
10Accepted4/4111ms6336 KiB
11Accepted4/4123ms8464 KiB
12Accepted4/4136ms11032 KiB
13Accepted4/4140ms13812 KiB
14Accepted4/4141ms16452 KiB
15Accepted4/4140ms19108 KiB
16Accepted4/4141ms21688 KiB
17Accepted4/4140ms24076 KiB
18Accepted5/5141ms26744 KiB
19Accepted6/6140ms29264 KiB
20Accepted6/6140ms32040 KiB
21Accepted2/23ms30664 KiB