80322024-01-12 10:58:51TortelliniJrÁruszállítás üres szakaszaicsharpWrong answer 17/50209ms41384 KiB
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace Szinezes
{
    class Program
    {
        static void Main(string[] args)
        {
            int[] inp = Console.ReadLine().Split().Select(int.Parse).ToArray();
            int all = inp[0];
            int arusz = inp[1];
            int[] ball = new int[all + 1];
            for (int i = 0; i < arusz; i++)
            {
                inp = Console.ReadLine().Split().Select(int.Parse).ToArray();
                ball[inp[0]]++;
                ball[inp[1]]--;
            }
            int sol = 0;
            int bal = 0;
            ball[0] = 1;
            for (int i = 1; i < all; i++)
            {
                bal += ball[i];
                if (bal == 0 && ball[i-1] != 0)
                {
                    sol++;
                }
            }
            Console.WriteLine(sol);
            Console.ReadLine();
        }
    }
}
SubtaskSumTestVerdictTimeMemory
base17/50
1Accepted0/030ms22128 KiB
2Accepted0/0206ms38140 KiB
3Wrong answer0/229ms22776 KiB
4Accepted2/232ms22948 KiB
5Wrong answer0/230ms23280 KiB
6Accepted2/232ms23500 KiB
7Accepted2/230ms24028 KiB
8Wrong answer0/232ms24064 KiB
9Wrong answer0/232ms24404 KiB
10Wrong answer0/232ms24380 KiB
11Accepted2/232ms24616 KiB
12Wrong answer0/232ms24836 KiB
13Wrong answer0/343ms27460 KiB
14Wrong answer0/346ms29840 KiB
15Wrong answer0/341ms28472 KiB
16Accepted3/3165ms33624 KiB
17Accepted3/3171ms33400 KiB
18Accepted3/3196ms33980 KiB
19Wrong answer0/350ms32164 KiB
20Wrong answer0/350ms33944 KiB
21Wrong answer0/3190ms41072 KiB
22Wrong answer0/3209ms41384 KiB