33832023-02-27 11:51:31AGergoÁruszállítás üres szakaszaicsharpWrong answer 16/50197ms39268 KiB
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace aruszallitas
{
    class Program
    {
        static void Main(string[] args)
        {
            string[] be = Console.ReadLine().Split();
            int allszam = int.Parse(be[0]);
            int szallszam = int.Parse(be[1]);
            int[] valt = new int[allszam+2];

            for (int i = 0; i < szallszam; i++)
            {
                be = Console.ReadLine().Split();
                valt[int.Parse(be[0])]++;
                valt[int.Parse(be[1])+1]--;
            }
            int jelen = 0;
            int intervallumok = 0;
            foreach (var item in valt)
            {
                jelen += item;
                
                if (jelen == 0 && item != 0)
                {
                    intervallumok++;
                }
            }
            Console.WriteLine(intervallumok);
            //Console.ReadKey();
        }
    }
}
SubtaskSumTestVerdictTimeMemory
base16/50
1Accepted0/028ms20636 KiB
2Accepted0/0197ms36528 KiB
3Wrong answer0/228ms20984 KiB
4Wrong answer0/228ms21212 KiB
5Wrong answer0/228ms21836 KiB
6Wrong answer0/227ms21932 KiB
7Wrong answer0/228ms22548 KiB
8Wrong answer0/228ms22868 KiB
9Accepted2/228ms23116 KiB
10Accepted2/228ms23068 KiB
11Wrong answer0/228ms23052 KiB
12Wrong answer0/228ms23612 KiB
13Wrong answer0/337ms25168 KiB
14Wrong answer0/341ms27004 KiB
15Wrong answer0/337ms25624 KiB
16Accepted3/3157ms31676 KiB
17Accepted3/3158ms32252 KiB
18Accepted3/3180ms31936 KiB
19Wrong answer0/346ms28972 KiB
20Wrong answer0/346ms29992 KiB
21Wrong answer0/3188ms39156 KiB
22Accepted3/3181ms39268 KiB