38332023-03-03 10:52:39AGergoFasor (40)csharpRuntime error 4/40148ms60484 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; 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/028ms20228 KiB
2Runtime error0/037ms21972 KiB
3Accepted2/227ms20944 KiB
4Accepted2/227ms21360 KiB
5Runtime error0/228ms21304 KiB
6Runtime error0/228ms21768 KiB
7Runtime error0/230ms22172 KiB
8Runtime error0/232ms22776 KiB
9Runtime error0/237ms24056 KiB
10Runtime error0/237ms24532 KiB
11Runtime error0/235ms24400 KiB
12Runtime error0/235ms24112 KiB
13Runtime error0/283ms40420 KiB
14Runtime error0/283ms38424 KiB
15Runtime error0/2130ms56364 KiB
16Runtime error0/2137ms58412 KiB
17Runtime error0/2143ms59792 KiB
18Runtime error0/2148ms59772 KiB
19Runtime error0/2146ms59900 KiB
20Runtime error0/276ms37164 KiB
21Runtime error0/2136ms57456 KiB
22Runtime error0/2146ms60484 KiB