93162024-02-20 12:47:13Leventusz09Átvágás (75 pont)csharpAccepted 75/75391ms39832 KiB
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace Átvágás{
    class Program{
        static void Main(){
            int N = int.Parse(Console.ReadLine());
            int[] A = new int[N], B = new int[N];
            string[] temp;

            int[] F = new int[N];
            int[] F2 = new int[N];
            for(int i=0; i<N-1; i++){
                temp = Console.ReadLine().Split();
                A[i] = int.Parse(temp[0]) - 1;
                B[i] = int.Parse(temp[1]) - 1;
                F[A[i]]++;
                F[B[i]]++;
                //F[B[i]]++;
            }
            int o1 = 0, o2= 0, Fmi=Array.IndexOf(F, F.Max());
            for(int i=0; i<N; i++){
                if (F[i] > 2) o1+= F[i] - 2;
                if (i != Fmi && F[i] > 1) o2+= F[i] - 1;
            }
            Console.WriteLine("{0} {1}", o1, o2);



        }
    }
}
SubtaskSumTestVerdictTimeMemory
base75/75
1Accepted0/029ms21680 KiB
2Accepted0/028ms22172 KiB
3Accepted0/043ms25296 KiB
4Accepted4/428ms22404 KiB
5Accepted4/430ms22792 KiB
6Accepted4/429ms23088 KiB
7Accepted4/429ms23368 KiB
8Accepted4/428ms23868 KiB
9Accepted4/428ms24156 KiB
10Accepted4/4321ms38356 KiB
11Accepted4/4333ms38468 KiB
12Accepted4/4374ms38564 KiB
13Accepted4/4352ms38732 KiB
14Accepted4/4354ms38788 KiB
15Accepted4/4354ms39540 KiB
16Accepted4/4391ms39744 KiB
17Accepted4/4361ms39636 KiB
18Accepted5/5354ms39664 KiB
19Accepted6/6365ms39832 KiB
20Accepted6/6352ms39640 KiB
21Accepted2/229ms25896 KiB