45792023-03-30 09:45:00TortelliniJrÁtvágás (75 pont)csharpPartially correct 71/75375ms34604 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 = 1000000;
            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/032ms21740 KiB
2Accepted0/030ms22072 KiB
3Accepted0/046ms26972 KiB
4Accepted4/430ms22288 KiB
5Accepted4/430ms22288 KiB
6Accepted4/430ms22788 KiB
7Accepted4/430ms23456 KiB
8Partially correct2/429ms23464 KiB
9Partially correct2/430ms23260 KiB
10Accepted4/4347ms32928 KiB
11Accepted4/4347ms33120 KiB
12Accepted4/4360ms33500 KiB
13Accepted4/4372ms33460 KiB
14Accepted4/4361ms33828 KiB
15Accepted4/4375ms33916 KiB
16Accepted4/4368ms34260 KiB
17Accepted4/4363ms34604 KiB
18Accepted5/5365ms34576 KiB
19Accepted6/6360ms34540 KiB
20Accepted6/6361ms34456 KiB
21Accepted2/230ms25068 KiB