33692023-02-27 11:24:18AGergoÁruszállítás üres szakaszaicsharpRuntime error 0/50165ms41216 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];

            for (int i = 0; i < allszam; i++)
            {
                valt[i] = 0;
            }
            


            for (int i = 0; i < szallszam; i++)
            {
                be = Console.ReadLine().Split();
                valt[int.Parse(be[0])] += 1;
                valt[int.Parse(be[1])] -= 1;
            }
            int jelen = 0;
            int intervallumok = 0;
            foreach (var item in valt)
            {
                if (item != 0)
                {
                    jelen += item;
                    if (jelen == 0)
                    {
                        intervallumok++;
                    }
                }
            }
            Console.WriteLine(intervallumok);
            Console.ReadKey();
        }
    }
}
SubtaskSumTestVerdictTimeMemory
base0/50
1Accepted0/028ms20808 KiB
2Runtime error0/064ms34344 KiB
3Wrong answer0/228ms21804 KiB
4Runtime error0/229ms21588 KiB
5Wrong answer0/228ms22552 KiB
6Wrong answer0/228ms22612 KiB
7Wrong answer0/228ms22760 KiB
8Wrong answer0/227ms23120 KiB
9Runtime error0/228ms22516 KiB
10Runtime error0/229ms23176 KiB
11Wrong answer0/228ms24320 KiB
12Wrong answer0/228ms24396 KiB
13Runtime error0/332ms24128 KiB
14Runtime error0/335ms25556 KiB
15Runtime error0/332ms25384 KiB
16Runtime error0/3143ms40728 KiB
17Runtime error0/3165ms40844 KiB
18Runtime error0/3163ms41216 KiB
19Runtime error0/334ms27928 KiB
20Runtime error0/335ms28916 KiB
21Runtime error0/359ms37168 KiB
22Runtime error0/343ms34212 KiB