46362023-03-30 13:31:50TortelliniJrKert (75 pont)csharpRuntime error 63/75437ms75196 KiB
using System;
using System.Collections.Generic;
using System.Linq;

namespace Kert
{
    class Program
    {
        static void Main(string[] args)
        {
            int[] inp = Console.ReadLine().Split().Select(int.Parse).ToArray();
            List<int> temp = new List<int>();
            int dom = 0;
            int azonosmax = 0;
            for (int u = 0; u < inp[0]; u++)
            {
                temp.Clear();
                temp.AddRange(Console.ReadLine().Split().Select(int.Parse));
                int most = temp.GroupBy(i => i)
                    .OrderByDescending(grp => grp.Count())
                    .First()
                    .Count();
                if (most > inp[1] / 2)
                {
                    dom++;
                }
                int longest = 1;
                int current = 1;
                for (int i = 1; i < temp.Count; i++)
                {
                    if (temp[i] == temp[i - 1])
                    {
                        current++;
                    }
                    else
                    {
                        longest = Math.Max(longest, current);
                        current = 1;
                    }
                }
                longest = Math.Max(longest, current);
                azonosmax = Math.Max(azonosmax, longest);
            }
            Console.WriteLine(dom);
            Console.WriteLine(azonosmax);
        }
    }
}
SubtaskSumTestVerdictTimeMemory
base63/75
1Accepted0/039ms22452 KiB
2Accepted0/0414ms71184 KiB
3Accepted4/437ms23096 KiB
4Accepted4/437ms23884 KiB
5Accepted4/439ms24140 KiB
6Accepted4/439ms24460 KiB
7Accepted4/441ms24968 KiB
8Accepted4/439ms25464 KiB
9Accepted4/439ms25640 KiB
10Accepted4/450ms28548 KiB
11Accepted6/643ms26780 KiB
12Accepted6/657ms31920 KiB
13Accepted6/692ms47168 KiB
14Accepted6/6437ms73016 KiB
15Runtime error0/6254ms75148 KiB
16Runtime error0/6337ms75196 KiB
17Accepted7/7277ms74692 KiB