117512024-11-09 01:24:05balintFasor (40)python3Time limit exceeded 20/40284ms27376 KiB
def main():
    n, k = map(int, input().split())
    nums = list(map(int, input().split()))

    for i in range(n):
        left_max = max(nums[max(0, i - k) : i] + [0])
        right_max = max(nums[i + 1 : min(i + 1 + k, n)] + [0])
        if max(left_max, right_max) <= nums[i]:
            print(i + 1)
            break
    else:
        print("-1")


main()
SubtaskSumTestVerdictTimeMemory
base20/40
1Accepted0/016ms3124 KiB
2Accepted0/019ms4156 KiB
3Accepted2/216ms3124 KiB
4Accepted2/216ms3112 KiB
5Accepted2/217ms2972 KiB
6Accepted2/217ms3068 KiB
7Accepted2/217ms3120 KiB
8Accepted2/218ms3128 KiB
9Accepted2/219ms4152 KiB
10Accepted2/220ms4152 KiB
11Accepted2/220ms4336 KiB
12Accepted2/217ms3888 KiB
13Time limit exceeded0/2275ms15540 KiB
14Time limit exceeded0/2275ms15312 KiB
15Time limit exceeded0/2275ms26500 KiB
16Time limit exceeded0/2277ms27376 KiB
17Time limit exceeded0/2277ms27236 KiB
18Time limit exceeded0/2275ms27048 KiB
19Time limit exceeded0/2280ms26304 KiB
20Time limit exceeded0/2284ms11576 KiB
21Time limit exceeded0/2280ms27176 KiB
22Time limit exceeded0/2280ms26320 KiB