93702024-02-21 10:19:24Leventusz09Leghosszabb béke (75 pont)csharpTime limit exceeded 6/75266ms29640 KiB
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace Leghosszabb_béke{
    class Program{
        static void Main(){
            string[] in1 = Console.ReadLine().Split();
            int N = int.Parse(in1[0]),
                M = int.Parse(in1[1]);

            bool[] Ds = new bool[N];
            int[] in2;

            for(int i=0, j; i<M; i++){
                in2 = Console.ReadLine().Split().Select(int.Parse).ToArray();
                for(j = in2[0]; j<=in2[1]; j++){
                    Ds[j - 1]=true;
                }
            }
            int o1 = 0, o2 = 0;

            if (Ds.Min()) { Console.WriteLine(-1); return; }

            for(int i=0, l = 0; i<N; i++){
                if (Ds[i]){
                    if (l > o1) {
                        o1 = l;
                        o2 = i - o1;
                        l = 0;
                    }
                }else{
                    l++;
                }
            }

            Console.WriteLine("{0} {1}", o1, o2+1);
        }
    }
}
SubtaskSumTestVerdictTimeMemory
base6/75
1Accepted0/035ms22280 KiB
2Time limit exceeded0/0250ms8524 KiB
3Accepted3/334ms23724 KiB
4Accepted3/334ms23492 KiB
5Wrong answer0/334ms23952 KiB
6Wrong answer0/334ms23516 KiB
7Wrong answer0/334ms24104 KiB
8Wrong answer0/434ms24712 KiB
9Wrong answer0/434ms25028 KiB
10Wrong answer0/435ms25308 KiB
11Wrong answer0/461ms28332 KiB
12Wrong answer0/497ms29404 KiB
13Wrong answer0/475ms27848 KiB
14Wrong answer0/479ms28888 KiB
15Wrong answer0/497ms29640 KiB
16Time limit exceeded0/4266ms9500 KiB
17Time limit exceeded0/4245ms9196 KiB
18Time limit exceeded0/4252ms9396 KiB
19Time limit exceeded0/4245ms10524 KiB
20Time limit exceeded0/4261ms9696 KiB
21Time limit exceeded0/4252ms9704 KiB
22Time limit exceeded0/4263ms9928 KiB