123852024-12-16 07:51:52birozsFasor (40)python3Accepted 40/40168ms27108 KiB
N,K=map(int,input().split())
lista = list(map(int,input().split()))
maxertek = [lista[0]]
for i in range(1,N):
    if lista[i] > maxertek[i-1]:
        maxertek.append(lista[i])
    else:
        maxertek.append(maxertek[i-1])
van = False
for i in range(N):
    if i - K < 0:
        bal = 0
    else:
        bal = i - K
    if i + K > N-1:
        jobb = N-1
    else:
        jobb = i + K
    if maxertek[bal] <= maxertek[i] >= maxertek[jobb]:
        print(i+1)
        van = True
        break
if not van:
    print(-1)
SubtaskSumTestVerdictTimeMemory
base40/40
1Accepted0/016ms3124 KiB
2Accepted0/021ms4372 KiB
3Accepted2/216ms3128 KiB
4Accepted2/216ms3132 KiB
5Accepted2/217ms2944 KiB
6Accepted2/216ms3128 KiB
7Accepted2/216ms3128 KiB
8Accepted2/217ms3384 KiB
9Accepted2/221ms4216 KiB
10Accepted2/220ms4152 KiB
11Accepted2/220ms4244 KiB
12Accepted2/220ms3972 KiB
13Accepted2/2111ms14764 KiB
14Accepted2/2118ms14576 KiB
15Accepted2/2153ms27108 KiB
16Accepted2/2158ms26088 KiB
17Accepted2/2149ms26332 KiB
18Accepted2/2150ms26332 KiB
19Accepted2/2168ms26388 KiB
20Accepted2/290ms11312 KiB
21Accepted2/2159ms26160 KiB
22Accepted2/2146ms25048 KiB