46382023-03-30 13:33:40TortelliniJrKert (75 pont)csharpRuntime error 56/75423ms75360 KiB
using System;
using System.Linq;

namespace Kert
{
    class Program
    {
        static void Main(string[] args)
        {
            int[] inp = Console.ReadLine().Split().Select(int.Parse).ToArray();
            int[][] matrix = new int[inp[0]][];
            int dom = 0;
            int azonosmax = 0;
            for (int i = 0; i < inp[0]; i++)
            {
                matrix[i] = Console.ReadLine().Split().Select(int.Parse).ToArray();
                int most = matrix[i].GroupBy(x => x).Max(grp => grp.Count());
                if (most > inp[1] / 2)
                {
                    dom++;
                }
                int longest = 1;
                int current = 1;
                for (int j = 1; j < matrix[i].Length; j++)
                {
                    if (matrix[i][j] == matrix[i][j - 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
base56/75
1Accepted0/037ms22264 KiB
2Accepted0/0412ms73668 KiB
3Accepted4/435ms22964 KiB
4Accepted4/435ms22852 KiB
5Accepted4/437ms23380 KiB
6Accepted4/435ms23516 KiB
7Accepted4/437ms23596 KiB
8Accepted4/435ms24272 KiB
9Accepted4/435ms24620 KiB
10Accepted4/448ms27520 KiB
11Accepted6/641ms25992 KiB
12Accepted6/654ms31084 KiB
13Accepted6/693ms46888 KiB
14Accepted6/6423ms72808 KiB
15Runtime error0/6275ms75360 KiB
16Runtime error0/6312ms74944 KiB
17Runtime error0/7157ms74596 KiB