제출 #647181

#제출 시각아이디문제언어결과실행 시간메모리
647181beaconmcGrowing Vegetables is Fun 4 (JOI21_ho_t1)Pypy 3
100 / 100
134 ms48408 KiB
n = int(input()) lis = list(map(int, input().split())) a = [0] b = [0] for i in range(len(lis)-1): a.append(a[-1] + max(0,lis[i]-lis[i+1]+1)) lis.reverse() for i in range(len(lis)-1): b.append(b[-1] + max(0,lis[i]-lis[i+1]+1)) b.reverse() print(min([max([a[i],b[i]]) for i in range(len(a))]))
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...