33792023-02-27 11:47:06AGergoÁruszállítás üres szakaszaicsharpRuntime error 0/50152ms35712 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])+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
1Accepted0/027ms20656 KiB
2Runtime error0/064ms34148 KiB
3Wrong answer0/228ms21932 KiB
4Runtime error0/228ms21376 KiB
5Wrong answer0/227ms22324 KiB
6Wrong answer0/227ms22484 KiB
7Wrong answer0/227ms22352 KiB
8Wrong answer0/227ms22540 KiB
9Runtime error0/228ms21924 KiB
10Runtime error0/228ms22360 KiB
11Wrong answer0/227ms23056 KiB
12Wrong answer0/228ms23336 KiB
13Runtime error0/329ms23380 KiB
14Runtime error0/332ms24744 KiB
15Runtime error0/330ms24876 KiB
16Runtime error0/3138ms32632 KiB
17Runtime error0/3152ms32648 KiB
18Runtime error0/3151ms32408 KiB
19Runtime error0/330ms25688 KiB
20Runtime error0/334ms26860 KiB
21Runtime error0/354ms35712 KiB
22Runtime error0/339ms32832 KiB