46252023-03-30 12:42:19Leventusz19Leghosszabb béke (75 pont)csharpTime limit exceeded 44/75277ms27888 KiB
using System;

namespace Leghoszabb_béke
{
    class Program
    {
        static void Main(string[] args)
        {
            string[] input = Console.ReadLine().Split(' ');
            int[] I = new int[input.Length];
            for (int i = 0; i < input.Length; i++)
            {
                I[i] = int.Parse(input[i]);
            }

            bool[] D = new bool[I[0]];
            for (int i = 0; i < I[1]; i++)
            {
                input = Console.ReadLine().Split(' ');
                int[] in2 = new int[input.Length];
                for (int j = 0; j < input.Length; j++)
                {
                    in2[j] = int.Parse(input[j]);
                }

                for (int j = in2[0]; j <= in2[1]; j++)
                {
                    D[j - 1] = true;
                }
            }

            int o = 0;
            int[] om = { 0, 0 };
            for (int i = 0; i < I[0]; i++)
            {
                if (!D[i])
                {
                    o++;
                }
                else
                {
                    o = 0;
                }

                if (o > om[0])
                {
                    om[0] = o;
                    om[1] = i;
                }
            }

            Console.WriteLine((om[0]) + " " + (om[1] + 2 - om[0]));
            Console.ReadKey();
        }
    }
}
SubtaskSumTestVerdictTimeMemory
base44/75
1Accepted0/028ms20388 KiB
2Time limit exceeded0/0268ms9268 KiB
3Wrong answer0/328ms21696 KiB
4Accepted3/327ms21648 KiB
5Accepted3/328ms22384 KiB
6Accepted3/327ms22476 KiB
7Accepted3/327ms23000 KiB
8Accepted4/427ms23288 KiB
9Accepted4/428ms23088 KiB
10Accepted4/428ms23664 KiB
11Accepted4/446ms26320 KiB
12Accepted4/468ms27516 KiB
13Accepted4/452ms26540 KiB
14Accepted4/456ms26656 KiB
15Accepted4/467ms27764 KiB
16Time limit exceeded0/4224ms27888 KiB
17Time limit exceeded0/4261ms9808 KiB
18Time limit exceeded0/4250ms9340 KiB
19Time limit exceeded0/4277ms10468 KiB
20Time limit exceeded0/4259ms9324 KiB
21Time limit exceeded0/4261ms9256 KiB
22Time limit exceeded0/4266ms9524 KiB