33632023-02-27 11:20:52BenedekÁruszállítás üres szakaszaicsharpWrong answer 3/50282ms37544 KiB
using System;
using System.Linq;

namespace Áruszállításüreszakaszai
{
    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[] p = new int[2 * m];
            int[] k = new int[2 * m];
            int pi = 0;

            for (int i = 0; i < m; i++)
            {
                st = Console.ReadLine().Split().Select(int.Parse).ToArray();

                p[pi] = st[0];
                k[pi] = 0;
                pi++;
                p[pi] = st[1] + 1;
                k[pi] = 1;
                pi++;


            }
            Array.Sort(p, k);
            int kezdo = 0;
            int vegzo = 0;
            int db = 0;
            for (int i = 0; i < p.Length; i++)
            {
                if (k[i] == 0)
                {
                    kezdo++;

                }
                else
                {
                    vegzo++;
                }

                if (kezdo == vegzo)
                {
                    db++;
                }


            }
            if (p[0] != 1)
            {
                db++;
            }
            if (p[m *2 -1] != N + 1)
            {
                db--;
            }
            Console.WriteLine(db);
            Console.ReadKey();
        }
    }
}
SubtaskSumTestVerdictTimeMemory
base3/50
1Wrong answer0/035ms22160 KiB
2Wrong answer0/0282ms33496 KiB
3Wrong answer0/234ms22912 KiB
4Wrong answer0/232ms23360 KiB
5Wrong answer0/235ms23660 KiB
6Wrong answer0/232ms24116 KiB
7Wrong answer0/234ms24368 KiB
8Wrong answer0/234ms24720 KiB
9Wrong answer0/232ms25092 KiB
10Wrong answer0/232ms25008 KiB
11Wrong answer0/234ms25320 KiB
12Wrong answer0/234ms25144 KiB
13Wrong answer0/346ms28168 KiB
14Wrong answer0/354ms29664 KiB
15Wrong answer0/346ms28400 KiB
16Wrong answer0/3211ms36196 KiB
17Wrong answer0/3224ms36332 KiB
18Wrong answer0/3243ms36728 KiB
19Wrong answer0/354ms30696 KiB
20Wrong answer0/357ms31208 KiB
21Accepted3/3254ms37360 KiB
22Wrong answer0/3264ms37544 KiB