33612023-02-27 11:19:09AGergoÁruszállítás üres szakaszaicsharpRuntime error 0/50157ms35504 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/028ms20856 KiB
2Runtime error0/059ms33784 KiB
3Wrong answer0/227ms21208 KiB
4Runtime error0/230ms20908 KiB
5Wrong answer0/228ms21912 KiB
6Wrong answer0/228ms22096 KiB
7Wrong answer0/228ms22796 KiB
8Wrong answer0/227ms22992 KiB
9Runtime error0/228ms22740 KiB
10Runtime error0/229ms22772 KiB
11Wrong answer0/228ms23744 KiB
12Wrong answer0/228ms23980 KiB
13Runtime error0/332ms24084 KiB
14Runtime error0/332ms24900 KiB
15Runtime error0/330ms24840 KiB
16Runtime error0/3143ms33008 KiB
17Runtime error0/3156ms32872 KiB
18Runtime error0/3157ms33184 KiB
19Runtime error0/332ms26368 KiB
20Runtime error0/332ms26924 KiB
21Runtime error0/357ms35504 KiB
22Runtime error0/341ms32784 KiB