33802023-02-27 11:48:08AGergoÁruszállítás üres szakaszaicsharpRuntime error 0/50152ms36364 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/028ms20892 KiB
2Runtime error0/063ms34140 KiB
3Wrong answer0/228ms21732 KiB
4Runtime error0/229ms21464 KiB
5Wrong answer0/227ms22320 KiB
6Wrong answer0/228ms22024 KiB
7Wrong answer0/228ms22176 KiB
8Wrong answer0/228ms22956 KiB
9Runtime error0/228ms22352 KiB
10Runtime error0/228ms22720 KiB
11Wrong answer0/227ms23380 KiB
12Wrong answer0/228ms23800 KiB
13Runtime error0/330ms24044 KiB
14Runtime error0/332ms25144 KiB
15Runtime error0/332ms25236 KiB
16Runtime error0/3144ms32948 KiB
17Runtime error0/3151ms33180 KiB
18Runtime error0/3152ms33664 KiB
19Runtime error0/332ms26536 KiB
20Runtime error0/332ms27588 KiB
21Runtime error0/357ms36364 KiB
22Runtime error0/341ms34192 KiB