33782023-02-27 11:45:19AGergoÁruszállítás üres szakaszaicsharpWrong answer 34/50192ms40376 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++;
                }
            }
            Console.WriteLine(intervallumok);
            //Console.ReadKey();
        }
    }
}
SubtaskSumTestVerdictTimeMemory
base34/50
1Accepted0/028ms20684 KiB
2Accepted0/0192ms36508 KiB
3Wrong answer0/228ms21088 KiB
4Wrong answer0/228ms21472 KiB
5Wrong answer0/228ms21936 KiB
6Wrong answer0/228ms22472 KiB
7Wrong answer0/228ms22660 KiB
8Wrong answer0/228ms23044 KiB
9Accepted2/228ms23184 KiB
10Accepted2/228ms23432 KiB
11Wrong answer0/228ms24012 KiB
12Wrong answer0/228ms24192 KiB
13Accepted3/337ms26124 KiB
14Accepted3/341ms27628 KiB
15Accepted3/337ms26524 KiB
16Accepted3/3152ms32604 KiB
17Accepted3/3156ms32732 KiB
18Accepted3/3172ms33148 KiB
19Accepted3/343ms30232 KiB
20Accepted3/348ms31324 KiB
21Accepted3/3184ms40300 KiB
22Accepted3/3187ms40376 KiB