112532024-07-30 21:38:10probaFasor (40)python3Runtime error 10/40217ms32004 KiB
# Bagoly
#z = list(map(int, '10 3'.split(' '))); fa = list(map(int, '6 2 1 8 4 8 7 12 9 3'.split(' ')))
z = list(map(int, input().split(' '))); fa = list(map(int, input().split(' ')))

fszam, tav = z[0], z[1]
max1 = []

def bont(i, lista, max1):
    m = lista.index(max(lista))
    max1 += [m+i]
    if len(lista[:m]) > 2*tav:
        bont(0, lista[:m], max1)
    if len(lista[m+1:]) > 2*tav:
        bont(m, lista[m+1:], max1)
        
bont(0, fa, max1)
max1.sort()
i = 0
while max(fa[max1[i]-tav:max1[i]+tav+1]) != fa[max1[i]]:
    i += 1
print(max1[i]+1)
    
    
    
    
    
    
    
    


    
    


        
    
    

SubtaskSumTestVerdictTimeMemory
base10/40
1Accepted0/017ms3044 KiB
2Runtime error0/025ms4368 KiB
3Runtime error0/218ms3004 KiB
4Accepted2/218ms3044 KiB
5Runtime error0/217ms2968 KiB
6Accepted2/218ms3104 KiB
7Runtime error0/218ms3196 KiB
8Runtime error0/218ms3100 KiB
9Runtime error0/2128ms32004 KiB
10Runtime error0/225ms4324 KiB
11Runtime error0/2150ms32004 KiB
12Runtime error0/246ms9200 KiB
13Accepted2/2107ms18260 KiB
14Accepted2/256ms14716 KiB
15Wrong answer0/2118ms26160 KiB
16Time limit exceeded0/2217ms28388 KiB
17Wrong answer0/2180ms27032 KiB
18Time limit exceeded0/2214ms30996 KiB
19Runtime error0/2186ms32004 KiB
20Accepted2/246ms11240 KiB
21Wrong answer0/282ms26072 KiB
22Wrong answer0/293ms25112 KiB