163942025-04-29 11:56:44algoproFasor (40)pypy3Time limit exceeded 20/40303ms32000 KiB
# UUID: 0726901d-fa91-48df-999f-c5987f51c588
def solve():
    n, k = map(int, input().split())
    heights = 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 int(heights[j]) > int(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/046ms19424 KiB
2Accepted0/050ms21204 KiB
3Accepted2/239ms19432 KiB
4Accepted2/239ms19356 KiB
5Accepted2/246ms19524 KiB
6Accepted2/246ms19436 KiB
7Accepted2/239ms19696 KiB
8Accepted2/248ms21444 KiB
9Accepted2/248ms21228 KiB
10Accepted2/243ms21228 KiB
11Accepted2/261ms22420 KiB
12Accepted2/250ms21292 KiB
13Time limit exceeded0/2280ms31212 KiB
14Time limit exceeded0/2282ms31852 KiB
15Runtime error0/268ms32000 KiB
16Runtime error0/261ms32000 KiB
17Runtime error0/268ms32000 KiB
18Runtime error0/261ms32000 KiB
19Runtime error0/261ms32000 KiB
20Time limit exceeded0/2303ms31464 KiB
21Runtime error0/261ms32000 KiB
22Runtime error0/268ms32000 KiB