33872023-02-27 12:03:22AGergoÁruszállítás üres szakaszaicsharpWrong answer 34/50199ms39796 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])]--;
            }
            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
base34/50
1Accepted0/028ms20876 KiB
2Accepted0/0199ms36616 KiB
3Wrong answer0/228ms21332 KiB
4Wrong answer0/228ms21644 KiB
5Wrong answer0/228ms22108 KiB
6Wrong answer0/228ms22196 KiB
7Wrong answer0/228ms22944 KiB
8Wrong answer0/228ms22552 KiB
9Accepted2/228ms22824 KiB
10Accepted2/228ms22484 KiB
11Wrong answer0/228ms22824 KiB
12Wrong answer0/228ms23520 KiB
13Accepted3/337ms25656 KiB
14Accepted3/341ms27056 KiB
15Accepted3/337ms26316 KiB
16Accepted3/3152ms32132 KiB
17Accepted3/3157ms32040 KiB
18Accepted3/3181ms32556 KiB
19Accepted3/343ms29068 KiB
20Accepted3/348ms30416 KiB
21Accepted3/3190ms39696 KiB
22Accepted3/3188ms39796 KiB