33752023-02-27 11:41:02AGergoÁruszállítás üres szakaszaicsharpWrong answer 0/50216ms39808 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+1];

            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
base0/50
1Wrong answer0/029ms20808 KiB
2Wrong answer0/0216ms36448 KiB
3Wrong answer0/229ms21648 KiB
4Wrong answer0/228ms21908 KiB
5Wrong answer0/228ms21740 KiB
6Wrong answer0/228ms22300 KiB
7Wrong answer0/227ms22564 KiB
8Wrong answer0/228ms23028 KiB
9Wrong answer0/228ms22944 KiB
10Wrong answer0/228ms23552 KiB
11Wrong answer0/228ms23716 KiB
12Wrong answer0/228ms23896 KiB
13Wrong answer0/337ms25532 KiB
14Wrong answer0/343ms26952 KiB
15Wrong answer0/337ms26336 KiB
16Wrong answer0/3155ms32116 KiB
17Wrong answer0/3155ms31900 KiB
18Wrong answer0/3172ms31988 KiB
19Wrong answer0/346ms28932 KiB
20Wrong answer0/348ms30284 KiB
21Wrong answer0/3179ms39464 KiB
22Wrong answer0/3189ms39808 KiB