78582024-01-11 13:45:46ananászLegmesszebbi rossz sorrendű (35 pont)csharpTime limit exceeded 9/35284ms25404 KiB
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace leghosszabb_rossz
{
    class Program
    {
        static void Main(string[] args)
        {
            int N = int.Parse(Console.ReadLine());
            int[] szamok = Console.ReadLine().Split().Select(int.Parse).ToArray();
            int veg = N - 1;
            int kezd = 0;
            while (szamok[0] <= szamok[veg] && veg > 0)
            {
                veg--;
            }
            for (int i = 1; i < N; i++)
            {
                int akt = N - 1;
                while (szamok[i] <= szamok[akt] && akt - i > veg - kezd && i < akt)
                {
                    akt--;
                }
                if (akt - i > veg - kezd)
                {
                    kezd = i;
                    veg = akt;
                }
            }
            if (veg == 0)
            {
                Console.WriteLine(-1);
            }
            else
            {
                Console.WriteLine($"{kezd + 1} {veg + 1}");
            }

            Console.ReadKey();
        }
    }
}
SubtaskSumTestVerdictTimeMemory
base9/35
1Accepted0/030ms22476 KiB
2Time limit exceeded0/0270ms13356 KiB
3Accepted1/132ms23292 KiB
4Accepted1/130ms23504 KiB
5Accepted1/130ms23720 KiB
6Accepted1/130ms23488 KiB
7Accepted1/130ms23888 KiB
8Accepted1/137ms24948 KiB
9Accepted1/141ms24988 KiB
10Accepted1/148ms25224 KiB
11Accepted1/156ms25404 KiB
12Time limit exceeded0/2270ms9864 KiB
13Time limit exceeded0/2263ms10200 KiB
14Time limit exceeded0/2256ms10496 KiB
15Time limit exceeded0/2268ms9096 KiB
16Time limit exceeded0/2256ms10620 KiB
17Time limit exceeded0/2270ms12860 KiB
18Time limit exceeded0/2284ms13752 KiB
19Time limit exceeded0/2268ms14644 KiB
20Time limit exceeded0/2272ms15312 KiB
21Time limit exceeded0/2277ms15828 KiB
22Time limit exceeded0/2264ms15540 KiB
23Time limit exceeded0/2261ms15044 KiB
24Time limit exceeded0/2261ms15348 KiB