45962023-03-30 10:39:29TortelliniJrKert (75 pont)csharpFutási hiba 68/75456ms74680 KiB
using System;
using System.Linq;
using System.Collections.Generic;
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 = Console.ReadLine().Split().Select(int.Parse).ToList();
                int most = temp.GroupBy(i => i).OrderByDescending(grp => grp.Count()).First().Count();
                if (most > inp[1] / 2)
                {
                    dom++;
                }
                int longestSeriesCount = temp.Skip(1)
                             .Aggregate(new { Value = temp[0], Count = 1, Longest = new { Value = temp[0], Count = 1 } },
                                        (acc, x) => x == acc.Value ? new { Value = x, Count = acc.Count + 1, Longest = acc.Count + 1 > acc.Longest.Count ? new { Value = x, Count = acc.Count + 1 } : acc.Longest } :
                                                                   new { Value = x, Count = 1, Longest = acc.Longest })
                             .Longest.Count;
                if (longestSeriesCount > azonosmax)
                {
                    azonosmax = longestSeriesCount;
                }
            }
            Console.WriteLine(dom);
            Console.WriteLine(azonosmax);
        }
    }
}
RészfeladatÖsszpontTesztVerdiktIdőMemória
base68/75
1Elfogadva0/039ms22360 KiB
2Elfogadva0/0428ms68636 KiB
3Elfogadva4/441ms23200 KiB
4Elfogadva4/439ms23316 KiB
5Elfogadva4/439ms23508 KiB
6Elfogadva4/439ms23816 KiB
7Elfogadva4/441ms24224 KiB
8Elfogadva4/441ms24784 KiB
9Elfogadva4/441ms24956 KiB
10Elfogadva4/452ms28392 KiB
11Elfogadva6/646ms25660 KiB
12Elfogadva6/661ms32088 KiB
13Elfogadva6/6100ms50976 KiB
14Elfogadva6/6435ms71088 KiB
15Elfogadva6/6389ms74584 KiB
16Elfogadva6/6456ms70600 KiB
17Futási hiba0/7280ms74680 KiB