80742024-01-12 12:01:41TortelliniJrÁruszállítás üres szakaszaicsharpAccepted 50/50208ms41336 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;
            int el = 1;
            for (int i = 1; i < all; i++)
            {
                bal += ball[i];
                if (bal == 0 && el != 0)
                {
                    sol++;
                }
                el = bal;
            }
            Console.WriteLine(sol);
            Console.ReadLine();
        }
    }
}
SubtaskSumTestVerdictTimeMemory
base50/50
1Accepted0/032ms22196 KiB
2Accepted0/0208ms38228 KiB
3Accepted2/232ms22976 KiB
4Accepted2/230ms23008 KiB
5Accepted2/232ms23312 KiB
6Accepted2/230ms23728 KiB
7Accepted2/232ms23968 KiB
8Accepted2/232ms24184 KiB
9Accepted2/230ms24404 KiB
10Accepted2/230ms24504 KiB
11Accepted2/232ms25072 KiB
12Accepted2/232ms25156 KiB
13Accepted3/343ms28308 KiB
14Accepted3/348ms29808 KiB
15Accepted3/343ms28676 KiB
16Accepted3/3173ms33396 KiB
17Accepted3/3178ms33880 KiB
18Accepted3/3193ms34056 KiB
19Accepted3/350ms32520 KiB
20Accepted3/352ms33928 KiB
21Accepted3/3195ms41336 KiB
22Accepted3/3202ms41256 KiB