46162023-03-30 12:15:27csicsilla70Kert (75 pont)csharpRuntime error 56/75395ms78768 KiB
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace kert
{
    class Program
    {
        static void Main(string[] args)
        {
            
            int[] in1 = Console.ReadLine().Split().Select(int.Parse).ToArray();
            int[] S;
            int[] p = new int[in1[2]];
            int max;
            int o1 = 0, o2 = 0, o2m = 0;
            for (int i = 0, j, last; i < in1[0]; i++)
            {
                S = Console.ReadLine().Split().Select(int.Parse).ToArray();
                HashSet<int> x = new HashSet<int>(S);
                Dictionary<int, int> y = new Dictionary<int, int>();
                foreach (var item in x)
                {
                    y.Add(item, 0);
                }
                foreach (var item in S)
                {
                    y[item]++;
                }
                max = y.Values.Max();
                if(max > in1[1] / 2) o1++;
                last = 0;
                o2 = 1;
                //p = new int[in1[2]];
                for (j = 0; j < in1[1]; j++)
                {
                   // p[S[j] - 1]++;

                    if (S[j] == last)
                    {
                        o2++;
                        if (o2 > o2m)
                        {
                            //o2t = i;
                            o2m = o2;
                        }
                    }
                    else
                        o2 = 1;
                    last = S[j];
                }
                
            }
            Console.WriteLine(o1 + "\n" + o2m);
            Console.ReadKey();
        }
    }
}
SubtaskSumTestVerdictTimeMemory
base56/75
1Accepted0/039ms23296 KiB
2Runtime error0/0209ms78768 KiB
3Accepted4/437ms23996 KiB
4Accepted4/437ms24476 KiB
5Accepted4/437ms25392 KiB
6Accepted4/439ms25680 KiB
7Accepted4/439ms26048 KiB
8Accepted4/437ms26392 KiB
9Accepted4/437ms26948 KiB
10Accepted4/448ms29312 KiB
11Accepted6/643ms27668 KiB
12Accepted6/656ms31652 KiB
13Accepted6/690ms43560 KiB
14Accepted6/6395ms74860 KiB
15Runtime error0/6197ms75604 KiB
16Runtime error0/6181ms75520 KiB
17Runtime error0/7182ms75528 KiB