33852023-02-27 12:01:27AGergoÁruszállítás üres szakaszaicsharpWrong answer 14/50193ms40436 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])]--;
            }
            int jelen = 0;
            int intervallumok = 0;
            foreach (var item in valt)
            {
                jelen += item;
                
                if (jelen == 0 && item != 0)
                {
                    intervallumok++;
                }
            }

            if (valt[1] ==0)
            {
                intervallumok++;
            }
            Console.WriteLine(intervallumok);
            //Console.ReadKey();
        }
    }
}
SubtaskSumTestVerdictTimeMemory
base14/50
1Accepted0/027ms20680 KiB
2Wrong answer0/0190ms36656 KiB
3Accepted2/228ms21412 KiB
4Wrong answer0/228ms21736 KiB
5Accepted2/228ms21824 KiB
6Accepted2/228ms22072 KiB
7Accepted2/228ms22544 KiB
8Accepted2/228ms22404 KiB
9Wrong answer0/228ms22556 KiB
10Wrong answer0/228ms23040 KiB
11Accepted2/228ms23096 KiB
12Accepted2/228ms23548 KiB
13Wrong answer0/337ms26008 KiB
14Wrong answer0/341ms27256 KiB
15Wrong answer0/337ms26364 KiB
16Wrong answer0/3152ms32100 KiB
17Wrong answer0/3158ms32188 KiB
18Wrong answer0/3177ms32672 KiB
19Wrong answer0/343ms29624 KiB
20Wrong answer0/348ms30944 KiB
21Wrong answer0/3178ms40436 KiB
22Wrong answer0/3193ms40160 KiB