46232023-03-30 12:38:59Leventusz19Leghosszabb béke (75 pont)csharpRuntime error 0/7589ms40640 KiB
using System;
using System.Linq;
using System.Threading.Tasks;

namespace Leghosszabb_béke{
    class Program{
        static void Main(string[] args){
            int[] I = Console.ReadLine().Split().Select(int.Parse).ToArray();
            bool[] D = new bool[I[0]];
            Parallel.For(0, I[1], i =>
            {
                int[] in2 = Console.ReadLine().Split().Select(int.Parse).ToArray();
                Enumerable.Range(in2[0], in2[1]-in2[0]+1).ToList().ForEach(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
base0/75
1Runtime error0/068ms25580 KiB
2Runtime error0/089ms37604 KiB
3Runtime error0/379ms27692 KiB
4Runtime error0/365ms27240 KiB
5Runtime error0/368ms28080 KiB
6Runtime error0/368ms28040 KiB
7Runtime error0/368ms28140 KiB
8Runtime error0/467ms28496 KiB
9Runtime error0/467ms29048 KiB
10Runtime error0/464ms31000 KiB
11Runtime error0/475ms34376 KiB
12Runtime error0/474ms36048 KiB
13Runtime error0/475ms36252 KiB
14Runtime error0/474ms35588 KiB
15Runtime error0/485ms38436 KiB
16Runtime error0/475ms37024 KiB
17Runtime error0/471ms35728 KiB
18Runtime error0/475ms37604 KiB
19Runtime error0/475ms37340 KiB
20Runtime error0/481ms39348 KiB
21Runtime error0/483ms40640 KiB
22Runtime error0/472ms38568 KiB