38802023-03-03 13:18:59AGergoFasor (40)csharpTime limit exceeded 20/40270ms26108 KiB
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace benzin
{
    class Program
    {
        static void Main(string[] args)
        {
            string[] be = Console.ReadLine().Split();

            int szam = int.Parse(be[0]);
            int lato = int.Parse(be[1]);

            int[] fak = new int[szam + 2*lato];

            be = Console.ReadLine().Split();

            for (int i = 0; i < be.Length; i++)
            {
                fak[i + lato] = int.Parse(be[i]);
            }

            int temp = 0;

            for (int i = lato; i < szam + lato; i++)
            {
                temp = 0;
                for (int j = lato*-1; j < lato + 1; j++)
                {
                    if (fak[i + j] > fak[i])
                    {
                        break;
                    }
                    else
                    {
                        temp++;
                    }
                }

                if (temp == 2 * lato + 1)
                {
                    Console.WriteLine(i - lato + 1);
                    break;
                }


            }

            if (temp != 2 * lato + 1)
            {
                Console.WriteLine(-1);

            }
            Console.ReadKey();
        }
    }
}
SubtaskSumTestVerdictTimeMemory
base20/40
1Accepted0/028ms20396 KiB
2Accepted0/037ms23084 KiB
3Accepted2/227ms21200 KiB
4Accepted2/227ms21396 KiB
5Accepted2/228ms21604 KiB
6Accepted2/228ms22008 KiB
7Accepted2/232ms22900 KiB
8Accepted2/234ms23476 KiB
9Accepted2/237ms24756 KiB
10Accepted2/237ms25084 KiB
11Accepted2/237ms25696 KiB
12Accepted2/237ms25428 KiB
13Time limit exceeded0/2263ms16176 KiB
14Time limit exceeded0/2246ms15084 KiB
15Time limit exceeded0/2261ms23940 KiB
16Time limit exceeded0/2263ms25292 KiB
17Time limit exceeded0/2268ms26108 KiB
18Time limit exceeded0/2266ms25804 KiB
19Time limit exceeded0/2250ms26020 KiB
20Time limit exceeded0/2270ms14512 KiB
21Time limit exceeded0/2266ms24292 KiB
22Time limit exceeded0/2270ms26076 KiB