45802023-03-30 09:47:20TortelliniJrÁtvágás (75 pont)csharpPartially correct 71/75375ms35116 KiB
using System;
using System.Linq;
namespace Átvágás
{
    class Program
    {
        static void Main(string[] args)
        {
            int num = int.Parse(Console.ReadLine());
            int[] kapcs = new int[num + 1];
            int[] inp = new int[2];
            for (int i = 0; i < num - 1; i++)
            {
                inp = Console.ReadLine().Split().Select(int.Parse).ToArray();
                kapcs[inp[0]]++;
                kapcs[inp[1]]++;
            }
            int er1 = 0;
            int er2 = int.MaxValue;
            for (int i = 0; i < num; i++)
            {
                if (kapcs[i] - 2 > 0)
                {
                    er1 += kapcs[i] - 2;
                }
                if (er2 > num - 1 - kapcs[i])
                {
                    er2 = num - 1 - kapcs[i];
                }
            }
            Console.WriteLine(er1 + " " + er2);
        }
    }
}
SubtaskSumTestVerdictTimeMemory
base71/75
1Accepted0/029ms22012 KiB
2Accepted0/029ms22260 KiB
3Accepted0/046ms27532 KiB
4Accepted4/430ms23272 KiB
5Accepted4/429ms23276 KiB
6Accepted4/429ms23520 KiB
7Accepted4/429ms23628 KiB
8Partially correct2/429ms23916 KiB
9Partially correct2/432ms24260 KiB
10Accepted4/4335ms33696 KiB
11Accepted4/4347ms33836 KiB
12Accepted4/4354ms34412 KiB
13Accepted4/4361ms34376 KiB
14Accepted4/4360ms34320 KiB
15Accepted4/4375ms34320 KiB
16Accepted4/4372ms34128 KiB
17Accepted4/4365ms34412 KiB
18Accepted5/5365ms34820 KiB
19Accepted6/6363ms34852 KiB
20Accepted6/6363ms35116 KiB
21Accepted2/230ms25828 KiB