33892023-02-27 12:10:56CsongiÁruszállítás üres szakaszaicsharpAccepted 50/50232ms34448 KiB
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace aruszallitas_nemes01
{
    internal class Program
    {
        static void Main(string[] args)
        {
            int[] st = Console.ReadLine().Split().Select(int.Parse).ToArray();
            int N = st[0];
            int M = st[1];
            int[] E = new int[M];
            int[] V = new int[M];
            for (int i = 0; i < M; i++)
            {
                st = Console.ReadLine().Split().Select(int.Parse).ToArray();
                E[i] = st[0];
                V[i] = st[1];
            }
            Array.Sort(E, V);
            int db = 0;
            if (E[0] != 1) { db++; }
            int e = E[0], v = V[0];
            for (int i = 1; i < M; i++)
            {
                if (e == E[i] || E[i] <= v)
                {
                    if (v < V[i])
                    {
                        v = V[i];
                    }
                }
                else  
                {
                    db++;
                    e = E[i];
                    v = V[i];
                }
            }
            if (v != N)
            {
                db++;
            }
            Console.WriteLine(db);
        }
    }
}
SubtaskSumTestVerdictTimeMemory
base50/50
1Accepted0/034ms22152 KiB
2Accepted0/0232ms32084 KiB
3Accepted2/230ms22764 KiB
4Accepted2/230ms23176 KiB
5Accepted2/232ms22892 KiB
6Accepted2/232ms22900 KiB
7Accepted2/232ms23360 KiB
8Accepted2/232ms23580 KiB
9Accepted2/232ms23780 KiB
10Accepted2/232ms23928 KiB
11Accepted2/234ms24072 KiB
12Accepted2/235ms24680 KiB
13Accepted3/345ms27812 KiB
14Accepted3/348ms29136 KiB
15Accepted3/343ms27140 KiB
16Accepted3/3200ms33956 KiB
17Accepted3/3193ms33932 KiB
18Accepted3/3221ms34308 KiB
19Accepted3/350ms29344 KiB
20Accepted3/352ms30004 KiB
21Accepted3/3218ms34400 KiB
22Accepted3/3222ms34448 KiB