Submission #647181

#TimeUsernameProblemLanguageResultExecution timeMemory
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...