33672023-02-27 11:22:13AGergoÁruszállítás üres szakaszaicsharpRuntime error 0/50165ms36316 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 < 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/028ms20880 KiB
2Runtime error0/064ms34080 KiB
3Wrong answer0/228ms21204 KiB
4Runtime error0/229ms20644 KiB
5Wrong answer0/228ms22072 KiB
6Wrong answer0/228ms22172 KiB
7Wrong answer0/229ms22588 KiB
8Wrong answer0/229ms22612 KiB
9Runtime error0/229ms22632 KiB
10Runtime error0/229ms22776 KiB
11Wrong answer0/228ms23912 KiB
12Wrong answer0/229ms24188 KiB
13Runtime error0/332ms24428 KiB
14Runtime error0/332ms25940 KiB
15Runtime error0/332ms25540 KiB
16Runtime error0/3143ms34148 KiB
17Runtime error0/3165ms34520 KiB
18Runtime error0/3152ms34288 KiB
19Runtime error0/332ms27128 KiB
20Runtime error0/334ms27904 KiB
21Runtime error0/357ms36316 KiB
22Runtime error0/341ms33532 KiB