33562023-02-27 10:52:31BenedekÁruszállítás üres szakaszaicsharpWrong answer 4/50275ms36672 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)
            {
                db++;
            }
            Console.WriteLine(db);
            Console.ReadKey();
        }
    }
}
SubtaskSumTestVerdictTimeMemory
base4/50
1Accepted0/034ms22228 KiB
2Wrong answer0/0275ms33368 KiB
3Wrong answer0/232ms22552 KiB
4Wrong answer0/232ms23148 KiB
5Accepted2/232ms23568 KiB
6Wrong answer0/232ms23460 KiB
7Wrong answer0/232ms23524 KiB
8Accepted2/235ms24188 KiB
9Wrong answer0/232ms24480 KiB
10Wrong answer0/232ms24460 KiB
11Wrong answer0/232ms24248 KiB
12Wrong answer0/234ms24368 KiB
13Wrong answer0/346ms27656 KiB
14Wrong answer0/352ms28800 KiB
15Wrong answer0/348ms28120 KiB
16Wrong answer0/3216ms35868 KiB
17Wrong answer0/3217ms36064 KiB
18Wrong answer0/3250ms36188 KiB
19Wrong answer0/357ms29940 KiB
20Wrong answer0/356ms30656 KiB
21Wrong answer0/3259ms36268 KiB
22Wrong answer0/3270ms36672 KiB