163932025-04-29 11:55:57algoproFasor (40)pypy3Runtime error 20/4079ms32000 KiB
# UUID: c86064e2-a1a0-4d02-9621-074f5bfda9c4
def solve():
    n, k = map(int, input().split())
    heights = tuple(map(int, input().split()))

    for i in range(n):
        taller_found = False
        for j in range(max(0, i - k), min(n, i + k + 1)):
            if i != j and abs(i - j) <= k and heights[j] > heights[i]:
                taller_found = True
                break
        if not taller_found:
            print(i + 1)
            return

if __name__ == "__main__":
    solve()
"""    
N,K=[int(x) for x in input().split()]
A= input().split()

res=0
done = False
while not done:
    for i in range(1,K+1):
        if res+i<N:
            if int(A[res])<int(A[res+i]):
                res+=i
                i=-1
                break
        else:
            done=True
            break
    if i==K:
        done=True

print(res+1)
"""
SubtaskSumTestVerdictTimeMemory
base20/40
1Accepted0/043ms19380 KiB
2Accepted0/048ms21452 KiB
3Accepted2/243ms19400 KiB
4Accepted2/239ms19400 KiB
5Accepted2/246ms19440 KiB
6Accepted2/243ms19476 KiB
7Accepted2/239ms19836 KiB
8Accepted2/248ms21612 KiB
9Accepted2/252ms21568 KiB
10Accepted2/248ms21324 KiB
11Accepted2/263ms22252 KiB
12Accepted2/246ms21504 KiB
13Runtime error0/279ms32000 KiB
14Runtime error0/278ms32000 KiB
15Runtime error0/261ms32000 KiB
16Runtime error0/261ms32000 KiB
17Runtime error0/270ms32000 KiB
18Runtime error0/270ms32000 KiB
19Runtime error0/261ms32000 KiB
20Runtime error0/267ms32000 KiB
21Runtime error0/271ms32000 KiB
22Runtime error0/271ms32000 KiB