#37167: python 紀錄


BensonDC (python戰士)

學校 : 不指定學校
編號 : 240921
來源 : [1.175.217.87]
最後登入時間 :
2024-03-27 12:33:26
f820. 極限運動 (Sports) -- TOI練習賽202104新手組第3題 | From: [36.238.105.93] | 發表日期 : 2023-08-23 16:42

N=int(input())
X=[int(x) for x in input().split()]
T=int(input())-1
while True:
    if T==0:
        if X[0]>X[1]:
            T=1
        else:break
    elif T==N-1:
        if X[T]>X[T-1]:
            T=T-1
        else:break
    else:
        if X[T]<X[T-1] and X[T]<X[T+1]:break
        else:
            if X[T]-X[T-1]>X[T]-X[T+1]:
                T-=1
            else:
                T+=1
print(T+1)

 
ZeroJudge Forum