33962023-02-27 12:25:59BenedekÁruszállítás üres szakaszaicsharpWrong answer 0/50402ms34448 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 + 1];
            int[] k = new int[2 * m + 1];
            p[p.Length - 1] = 1000000000;
            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];
                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 (i < p.Length - 1 && p[i] < p[i+1])
                {
                    Console.WriteLine($"{i} {kezdo} {vegzo} {p[i]} {db}");
                    if (kezdo == vegzo)
                    {
                        db++;
                    }
                }
                

            }
            if (p[0] != 1)
            {
                db++;
            }
            if (p[m * 2 - 1] == N)
            {
                db--;
            }

            Console.WriteLine(db);
            Console.ReadKey();
        }
    }
}
SubtaskSumTestVerdictTimeMemory
base0/50
1Wrong answer0/034ms22148 KiB
2Time limit exceeded0/0402ms10804 KiB
3Wrong answer0/234ms22884 KiB
4Wrong answer0/234ms23344 KiB
5Wrong answer0/235ms23468 KiB
6Wrong answer0/234ms23940 KiB
7Wrong answer0/234ms24184 KiB
8Wrong answer0/232ms24396 KiB
9Wrong answer0/235ms24652 KiB
10Wrong answer0/234ms24832 KiB
11Wrong answer0/235ms24980 KiB
12Wrong answer0/237ms26040 KiB
13Wrong answer0/398ms33872 KiB
14Wrong answer0/3104ms33840 KiB
15Wrong answer0/379ms33580 KiB
16Time limit exceeded0/3374ms14072 KiB
17Time limit exceeded0/3351ms14332 KiB
18Time limit exceeded0/3370ms14440 KiB
19Wrong answer0/3116ms34448 KiB
20Wrong answer0/3115ms34408 KiB
21Time limit exceeded0/3351ms14400 KiB
22Time limit exceeded0/3379ms14880 KiB