93552024-02-21 08:48:43Leventusz09Kert (75 pont)csharpAccepted 75/75365ms66848 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[] in1 = Console.ReadLine().Split();
            int N = int.Parse(in1[0]),
                M = int.Parse(in1[1]),
                P = int.Parse(in1[2]);

            //int[][] matrix = new int[N][];
            int[] temp, 
                row;

            int tmax, 
                last, 
                lasti;
            // tmi = 0;
            int o1 = 0, o2 = 0;
            for(int i=0, j; i<N; i++){
                //matrix[i] = new int[M];
                row = Console.ReadLine().Split().Select(int.Parse).ToArray();
                tmax = 0; temp = new int[P];
                last = -1; lasti = 1;
                for(j=0; j<M; j++) {
                    temp[row[j]-1]++;
                    if (temp[row[j] - 1] > tmax){
                        tmax = temp[row[j] - 1];
                        //tmi = row[i];
                    }
                    if(row[j] == last){
                        lasti++;
                        if (lasti > o2) o2 = lasti;
                    }else{
                        lasti = 1;
                    }
                    last = row[j];
                }
                if (tmax > M / 2) o1++;
            }
            Console.WriteLine("{0}\n{1}", o1, o2);
        }
    }
}
SubtaskSumTestVerdictTimeMemory
base75/75
1Accepted0/030ms22172 KiB
2Accepted0/0354ms27904 KiB
3Accepted4/430ms22836 KiB
4Accepted4/430ms22860 KiB
5Accepted4/432ms30088 KiB
6Accepted4/434ms30520 KiB
7Accepted4/434ms30980 KiB
8Accepted4/434ms31372 KiB
9Accepted4/434ms31388 KiB
10Accepted4/443ms33652 KiB
11Accepted6/639ms32364 KiB
12Accepted6/648ms27200 KiB
13Accepted6/682ms26552 KiB
14Accepted6/6365ms29476 KiB
15Accepted6/6337ms66848 KiB
16Accepted6/6363ms30364 KiB
17Accepted7/7211ms29308 KiB