38372023-03-03 11:00:28AGergoFasor (40)csharpRuntime error 4/40145ms61028 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 + 6];

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

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

            int temp = 0;

            for (int i = 3; i < szam + 3; 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 - 2);
                    break;
                }


            }

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

            }
            //Console.ReadKey();
        }
    }
}
SubtaskSumTestVerdictTimeMemory
base4/40
1Accepted0/028ms20888 KiB
2Runtime error0/035ms22560 KiB
3Accepted2/228ms21156 KiB
4Accepted2/227ms21676 KiB
5Runtime error0/228ms21100 KiB
6Runtime error0/229ms21664 KiB
7Runtime error0/232ms22340 KiB
8Runtime error0/232ms22644 KiB
9Runtime error0/235ms24092 KiB
10Runtime error0/237ms25228 KiB
11Runtime error0/237ms25108 KiB
12Runtime error0/235ms24944 KiB
13Runtime error0/287ms41220 KiB
14Runtime error0/282ms38960 KiB
15Runtime error0/2136ms57300 KiB
16Runtime error0/2137ms59080 KiB
17Runtime error0/2141ms61020 KiB
18Runtime error0/2141ms60840 KiB
19Runtime error0/2141ms60824 KiB
20Runtime error0/274ms37560 KiB
21Runtime error0/2130ms57660 KiB
22Runtime error0/2145ms61028 KiB