problem_id
stringclasses
100 values
submission_id
stringlengths
10
10
status
stringclasses
2 values
code
stringlengths
6
806
p02578
s557746451
Wrong Answer
N = int(input()) height = list(map(int,input().split())) ans = 0 for i in range(N-1): if height[i]>height[i+1]: ans += max(height[:i+1])-height[i+1] print(ans)
p02578
s813898652
Wrong Answer
n = int(input()) A = list(map(int,input().split())) step = 0 ma = max(A) idx = A.index(ma) for i in range(idx-1): dif = A[i+1]-A[i] if dif < 0: step += abs(dif) for i in range(idx,n): dif = ma-A[i] step += dif print(step)
p02578
s502456829
Wrong Answer
N=int(input()) Alist=list(map(int,input().split())) sum=0 if N==1: print(0) else: for i in range(1,N): if Alist[i]<max(Alist[:i]): sum=sum+max(Alist[:i])-Alist[i] Alist[i]=max(Alist) print(sum)
p02578
s480540080
Wrong Answer
import sys input = sys.stdin.readline N = int(input()) A = list(map(int,input().split())) stool = 0 for i in range(N): for j in range(i+1,i+2): if j >= N: break if A[i] > A[j]: stool += A[i] - A[j] A[j] += 1 print(stool)
p02578
s058846083
Wrong Answer
n=int(input()) l=[int(i) for i in input().split()] c=0 for i in range(1,n): c=max(c,max(l[i-1]-l[i],0)) l[i]+=max(l[i-1]-l[i],0) print(c)
p02578
s584416531
Wrong Answer
N = int(input()) A = list(map(int, input().split())) ans = 0 for i in range(N): if A[i-1] > A[i]: ans += A[i-1]-A[i] print(ans)
p02578
s455068595
Wrong Answer
N = int(input()) A = list(map(int, input().split())) before = 0 d = [0] * N for i in range(N): if i == 0: before = i continue if A[before] > A[i]: d[i] = (A[before] + d[before]) - A[i] before = i else: before = i print(sum(d))
p02578
s474395403
Wrong Answer
n = int(input()) a_list = list(map(int, input().split())) steps = [] step_ttl = 0 step = 0 for i, a in enumerate(a_list): if i == 0: steps.append(step) continue if a_list[i-1] + step < a: step = 0 steps.append(step) continue if a < step + a_list[i-1]: step = (step + a_list[i-1]) - a step_ttl += step steps.append(step) print(step_ttl) print(steps)
p02578
s263087284
Wrong Answer
N=int(input()) A=[int(_) for _ in input().split(" ")] ans=0 max=max(A) for i in range(len(A)): if A[i] == max: a=i break if a==0: total=0 for i in range(len(A)): total=total+max-A[i] print(total) exit() tmp=0 for i in range(a): if tmp < A[i]: tmp=A[i] #print("tmp",tmp,"a",a,"A[a]",A[a]) total=0 for i in range(a): total += tmp - A[i] #print("total",total) for i in range(a,len(A)): total += max - A[i] #print("total",total) print(total)
p02578
s199304096
Wrong Answer
n = int(input()) lis = list(map(int,input().split())) sum = 0 for i in range(n-1): if int(lis[i])>int(lis[i+1]): sum += lis[i]-lis[i+1] else: continue print(sum)
p02578
s770571654
Wrong Answer
n=int(input()) a_list = list(map(int,input().split())) a_tmp = a_list[0] sum = 0 for i in range(1, len(a_list)): if a_list[i] > a_tmp: sum += a_list[i] - a_tmp a_tmp = a_list[i] else: a_tmp = a_list[i] print(sum)
p02578
s602196631
Wrong Answer
N = int(input()) A = list(map(int, input().split())) A.sort() print(A[N - 1] - A[0])
p02578
s762905715
Wrong Answer
N = int(input()) a = list(map(int, input().split())) count = 0 i = 1 for i in range(N-1): if a[i-1] <= a[i]: continue elif a[i-1] > a[i]: diff = a[i-1] - a[i] count = count + diff a[i] = a[i-1] print(count)
p02578
s024776949
Wrong Answer
n = int(input()) a = list(map(int,input().split())) ans = 0 cnt = a[0] for i in range(n-1): ans += max(a[i+1]-a[i],0) print(ans)
p02578
s639688804
Wrong Answer
def abc176_c(): n = int(input()) a = list(map(int, input().split(' '))) ans = 0 for i in range(len(a) - 1): if a[i] < a[i + 1]: ans += a[i + 1] - a[i] print(ans) if __name__ == '__main__': abc176_c()
p02578
s731001532
Wrong Answer
N = int(input()) A = list(map(int, input().split())) s = 0 if N==1: print(0) exit() for i,a in enumerate(A): if i==0: continue tmp = A[i-1] - a s += (tmp>0)*tmp print(s)
p02578
s654747763
Wrong Answer
N = int(input()) A = [int(z) for y, z in enumerate(input().split()) if y < N and z.isdigit()] print(A) a = min(A) b = max(A) c = b - a print(c)
p02578
s762779139
Wrong Answer
N = int(input()) A = list(map(int,input().split())) high = 0 cnt = 0 for i in range(1,N): if high <= A[i]: high = A[i] if A[i] >= A[i-1]: cnt += high - A[i-1] print(cnt)
p02578
s772341647
Wrong Answer
# coding: utf-8 N = input() N = int(N) An = list(map(int, input().split())) cnt = 0 step = [] step_sum = 0 for i in range(0, N): if i == 0: step.append(0) continue diff = (An[i - 1] + step[i - 1]) - An[i] print('i ', i, 'diff ', diff) if diff <= 0: step.append(0) else: step.append(diff) for num in step: step_sum += num print(step_sum)
p02578
s963522639
Wrong Answer
n=int(input()) l=list(map(int,input().split())) t=0 x=0 for i in range(n): if t>l[i]: t+=t-l[i] x+=t-l[i] print(x)
p02578
s996211289
Wrong Answer
import sys input = sys.stdin.readline ins = lambda: input().rstrip() ini = lambda: int(input().rstrip()) inm = lambda: map(int, input().split()) inl = lambda: list(map(int, input().split())) out = lambda x: print('\n'.join(map(str, x))) n = ini() a = inl() ans = 0 for i in range(n): ans += max(0, a[i-1] - a[i]) print(ans)
p02578
s901738853
Wrong Answer
loop = int(input()) tall = list(map(int, input().split())) front = tall[0] standard = front result = 0 for i in range(1, loop): back = tall[i] if back-front > 0: standard = back elif back-front < 0: result += standard - back front = back print(result)
p02578
s093522407
Wrong Answer
N = int(input()) A = list(map(int,input().split())) ans = 0 high = 0 for i in range(1,N): if A[i-1] > high: high = A[i-1] if A[i] < high: high += high - A[i] print(ans)
p02578
s522239669
Wrong Answer
#!/usr/local/bin/python3 N = int(input()) A = list(map(int, input().split()))[::-1] ans = 0 m = A[0] s = n = 0 for i in range(N): if A[i] <= m: ans += n*m - s s = n = 0 m = A[i] s += A[i] n += 1 if A[i] <= m: ans += n*m - s print(ans)
p02578
s891879771
Wrong Answer
n = int(input()) a = list(map(int, input().split())) highest = 0 last = 0 for i in range(n): if a[i] >= highest: highest = a[i] last = i shortest = highest for j in range(0, last): if a[j] <= shortest: shortest = a[j] #print(shortest) print(highest - shortest)
p02578
s074382420
Wrong Answer
import sys input = sys.stdin.readline import numpy as np n = int(input()) A = [int(a) for a in input().strip().split()] pre = A[0] s = 0 for a in A: ad = max(0, a-pre) pre = a s += ad print(s)
p02578
s964795510
Wrong Answer
x = list(map(int, input().split())) print(x) A = x[1:] step = 0 num_min = 1000 for i in range(len(A)-1): if A[i] > A[i+1]: for j in range(A[i] - A[i+1]): step += 1 A[i+1] += 1 else: continue print(step)
p02578
s744889268
Wrong Answer
n = int(input()) a = list(map(int, input().split())) ans = 0 for i in range(n-1): if a[i+1] < a[i]: ans += a[i] - a[i+1] print(ans)
p02578
s118594866
Wrong Answer
N = int(input()) array = list(map(int,input().split())) new_array = [0] * N for i in range(N-1): if array[i] > array[i+1]: new_array[i+1] = array[i] print(sum(array) - sum(new_array))
p02578
s296233538
Wrong Answer
n = int(input()) A = list(map(int, input().split())) b = sum(A) s = 0 M = 0 for i in range(n-1): if A[i] <= A[(i+1)]: M = 0 continue else: if M == 0: s += A[i] - A[(i+1)] M = A[(i+1)] + (A[i] - A[(i+1)]) else: s += M - A[(i+1)] print(s)
p02578
s803520280
Wrong Answer
n=int(input()) A=list(map(int,input().split())) count=0 for i in range(1,len(A)): for j in range(i,0): if(a[j]<a[i]): count+=(abs(a[i]-a[j])) else: pass print(count)
p02578
s959036596
Wrong Answer
N=int(input()) A=list(map(int,input().split())) c=1000000000 for i in range(len(A)): base=A[i] cc=0 p=8 for t in range(0, i): if base<A[t]: p=6 break if p==6: continue for t in range(i, len(A)): if base>A[t]: cc+=base-A[t] if c > cc: c = cc print(c)
p02578
s126914189
Wrong Answer
n = int(input()) a = list(map(int, input().split())) ans = 0 i = 0 maxi = a[i] while True: if i == n - 1: break if a[i + 1] < a[i]: ans += (maxi - a[i + 1]) else: maxi = a[i + 1] i += 1 print(ans)
p02578
s806341607
Wrong Answer
N = int(input()) A = list(map(int,input().split())) ans = 0 high = 0 for i in range(1,N): af = A[i] bf = A[i-1] if bf > high: high = bf if af < bf: ans += high - af print(ans)
p02578
s584285327
Wrong Answer
n = int(input()) a_list = list(map(int, input().split())) h_list = [0]*(2*10**5+10) for i in range(1,n): if a_list[i] < a_list[i-1]: h_list[i] = a_list[i-1] + h_list[i-1] - a_list[i] elif a_list[i] >= a_list[i-1]: h_list[i] = 0 print(sum(h_list))
p02578
s270722873
Wrong Answer
n=int(input()) a=list(map(int,input().split())) ans=0 for i in range(1,n): if a[i]>a[i-1]: ans+=a[i]-a[i-1] print(ans)
p02578
s650364903
Wrong Answer
N = int(input()) A = list(map(int, input().split())) s = [0]*(N-1) for n in range(N-1): s[n] = A[n] - A[n+1] if s[n] <= 0: continue else: A[n+1] += s[n] print(sum(s))
p02578
s224137748
Wrong Answer
#C N=int(input()) A = list(map(int, input().split())) ans=0 for i in range(1,len(A)): if A[i]-A[i-1]>0: ans+=A[i]-A[i-1] print(ans)
p02578
s106631016
Wrong Answer
N = int(input()) A = list(map(int,input().split())) keep = 0 cnt =0 cnt2=0 for a in A: if keep > a: cnt += keep -a cnt2=0 cnt2 += keep -a keep = a + cnt2 print(cnt)
p02578
s321191502
Wrong Answer
n = input() s = list(map(int, input().split())) c = 1 for i in s: if max(s) - i == c: a = i break else: a = 0 print(a)
p02578
s199100132
Wrong Answer
n = int(input()) h = list(map(int, input().split())) left_max = h[0] steps = 0 for i in range(1, n): if(left_max > h[i]): steps += h[i]-left_max left_max = steps + h[i] print(steps)
p02578
s695279476
Wrong Answer
input() A=list(map(int,input().split())) print(sum(A[i] - A[i-1] for i in range(1,len(A)) if A[i] > A[i-1]))
p02578
s357642698
Wrong Answer
# -*- coding: utf-8 -*- N = int(input()) As = list(map(int, input().split())) res = 0 for i in range(N-1): if As[i] < As[i+1]: res += As[i+1] - As[i] print(res)
p02578
s945564392
Wrong Answer
import copy n = int(input()) a = input().split() list = copy.copy(a) ans = 0 for i in range(1,n): if a[i] < a[i-1]: a[i] = a[i-1] for j in range(n): if a[j] != list[j]: ans += abs(int(a[j]) - int(list[j])) print(ans)
p02578
s955126465
Wrong Answer
N = int(input()) A = list(map(int,input().split())) ans = 0 a = A.index(max(A)) l = A[a+1:] for i in range(1,N): bf = A[i-1] af = A[i] if a <= i: ans += max(A)*len(l)-sum(l) break elif bf > af: ans += bf-af print(ans)
p02578
s903588869
Wrong Answer
n = int(input()) l = list(map(int,input().split())) sum=0 for i in range(len(l)-1): if l[i+1]>l[i]: sum+=l[i+1]-l[i] print(sum)
p02578
s177698109
Wrong Answer
N = int(input()) A = [int(i) for i in input().split()] cnt = 0 max_A = A[0] for i in range(1,N): if A[i-1]<A[i]: max_A = A[i] else: cnt+=max_A-A[i] print(cnt)
p02578
s513129817
Wrong Answer
def main(): n = int(input()) As = list(map(int, input().split())) r = 0 max_a = 0 for a in range(n-1, -1, -1): if(a == 0): break splitAs = As[0:a-1] if As[a] < As[a-1]: if(0 < len(splitAs)): max_a = max(splitAs) tmp = As[a-1] - As[a] r += tmp if tmp + As[a] < max_a: r += max_a - (tmp + As[a]) print(r) main()
p02578
s674299165
Wrong Answer
N=int(input()) a=input().split() A=list(map(int,a)) print(A) tmp=0 count=0 for i in range(N): if(i==0): tmp=A[0] if(tmp<=A[i]): #print(A[i]) tmp=A[i] else: count+=1 print(count)
p02578
s513350521
Wrong Answer
def main(): N, A = int(input()), list(map(int, input().split())) ans = 0 for idx in range(1, N): if A[idx] > A[idx - 1]: ans += A[idx] - A[idx - 1] print('{}'.format(ans)) if __name__ == '__main__': main()
p02578
s063593862
Wrong Answer
N = int(input()) height = list(map(int,input().split())) ans = 0 for i in range(N-1): if height[i]>height[i+1]: ans += height[i]-height[i+1]+1 print(ans)
p02578
s406756315
Wrong Answer
N = int(input()) A = list(map(int, input().split())) now = A[0] ans = 0 for i in range(1,N): if A[i]<now: step = now - A[i] ans += now else: step = 0 now = A[i]+step print(ans)
p02578
s355812442
Wrong Answer
n = int(input()) a = list(map(int,input().split())) ans = 0 d = 0 for i in range(1,n): if a[i-1]+d > a[i]: d = abs(a[i-1]-a[i])+d ans += d else: d = 0 print(ans)
p02578
s633281811
Wrong Answer
N=int(input()) A=list(map(int,input().split())) B=0 Mi=A[0] for i in range(1,N): if A[i] > A[i-1]: Mi = A[i] B += Mi - A[i] print(B)
p02578
s813326892
Wrong Answer
N = int(input()) A = list(map(int,input().split())) ans = 0 high = 0 for i in range(1,N): af = A[i] bf = A[i-1] if bf > high: high = bf if high > af: ans += high - af print(high,bf,af,ans) print(ans)
p02578
s612576640
Wrong Answer
n = int(input()) list = list(map(int,input().split())) ans = 0 maxV = max(list) maxI = list.index(maxV) for i in range(maxI+1, len(list)): x = maxV - list[i] if x > 0: ans += x if maxI != 0: for i in range(0,maxI): if i != maxI: x = list[i] - list[i+1] if x > 0: ans += x print(ans)
p02578
s798691051
Wrong Answer
n = int(input()) a = list(map(int,input().split())) ans = 0 m = a[0] for i in range(1,n-1): if a[i] > m: ans += a[i]-m m = a[i] print(ans)
p02578
s286143378
Wrong Answer
n=int(input()) arr=list(map(int,input().split())) ans=0 for i in range(n-1): val=max(0,arr[i]-arr[i+1]) ans+=val arr[i]+=val print(ans)
p02578
s561745607
Wrong Answer
def main(): n = int(input()) As = list(map(int, input().split())) r = 0 max_a = max(As) for a in range(n-1, -1, -1): if a == 0: break if As[a] < As[a-1]: if(max_a not in As[0:a-1]): max_a = As[a-1] r += max_a - As[a] print(r) main()
p02578
s133669230
Wrong Answer
addNum = 0 n = input() s = input().split() for i in range(len(s)-1): if(s[i]>s[i+1]): a = int(s[i]) b = int(s[i+1]) c = a-b s[i+1] = s[i] addNum += c print(addNum)
p02578
s631697232
Wrong Answer
def solve(): n = int(input()) a = list(map(int, input().split())) mi = 0 le = len(a) cost = 0 for i in range(le-1): if a[i] > a[i+1]: mi = max(a[i], mi) cost += mi - a[i+1] cost += max(0, mi - a[-1]) print(cost) return 0 if __name__ == "__main__": solve()
p02578
s688407352
Wrong Answer
n = int(input()) a = input().split() height = 0 for i in range(n): if int(a[i]) < int(a[i - 1]): height += ( int(a[i - 1]) - int(a[i]) ) print(height)
p02578
s666827387
Wrong Answer
N = int(input()) A = list(map(int,input().split())) count=0 for i in range(N): try: a=A[i] b=A[i+1] while a>b: b+=1 count+=1 except: pass print(count)
p02578
s539183415
Wrong Answer
n=int(input()) s=list(map(int,input().split())) ans=0 for i in range(n-1): ans+=max(s[i+1]-s[i],0) print(ans)
p02578
s822250211
Wrong Answer
N=int(input()) A=list(map(int,input().split())) ans=0 high=A[0] for i in range(1,N): if A[i]>A[i-1]: high=A[i] else: ans+=high-A[i] print(ans)
p02578
s909157086
Wrong Answer
n=int(input()) a_list=list(map(int,input().split())) ans=0 tmp=a_list[0] for i in range(n-1): if tmp>a_list[i+1]: #print(tmp,ans) ans+=tmp-a_list[i+1] else: ans+=tmp-a_list[i] tmp=a_list[i+1] print(ans)
p02578
s602544733
Wrong Answer
N=int(input()) A=[int(_) for _ in input().split(" ")] ans=0 max=max(A) for i in range(len(A)): if A[i] == max: a=i break tmp=0 for i in range(a): if tmp < i: tmp=i total=0 for i in range(a): total += a - A[i] for i in range(a,len(A)): total += max -A[i] print(total)
p02578
s225159795
Wrong Answer
max_tool=0 n=int(input()) arr=list(map(int,input().split())) maxi=arr[0] for i in range(1,len(arr)): if arr[i]<maxi: max_tool=max(max_tool,maxi-arr[i]) else: maxi=arr[i] print (max_tool)
p02578
s484963283
Wrong Answer
N = int(input()) A = list(map(int,input().split())) ans = 0 a = A.index(max(A)) l = A[a+1:] for i in range(1,N): bf = A[i-1] af = A[i] if a < i: ans += max(A)*len(l)-sum(l) break elif bf > af: ans += bf-af print(ans)
p02578
s158630789
Wrong Answer
n = int(input()) a = list(map(int, input().split())) ans = 0 for i in range(n): if a[i-1] > a[i]: ans += a[i-1] - a[i] print(ans)
p02578
s480570693
Wrong Answer
n = int(input()) a = list(map(int,input().split())) m = max(a) s = 0 for i in range(n): if i == n-1: break else: if a[i]-a[i+1] < 0: s -= a[i]-a[i+1] print(s)
p02578
s596914335
Wrong Answer
N = int(input()) A = list(map(int,input().split())) keep = 0 cnt =0 x=0 for a in A: if keep > a: cnt += keep -a x=0 x += keep -a keep = a + x print(cnt)
p02578
s362343798
Wrong Answer
def main(): N = int(input()) A = list(map(int, input().split())) i = A[0] T = 0 for n in A: if n > i: T += n -i if n < i: T = i print(T) if __name__ == "__main__": main()
p02578
s558704231
Wrong Answer
N = int(input()) heights = list(map(int, input().split())) humidai = [] for i in range(len(heights)): if humidai == []: humidai.append(0) else: h_height = heights[i] - heights[i-1] if h_height > 0: humidai.append(h_height) else: humidai.append(0) print(sum(humidai))
p02578
s512760117
Wrong Answer
def main(): N = int(input()) A = list(map(int, input().split())) count = 0 highest = A[0] for height in range(len(A)-1): if A[height] > A[height+1]: if A[height] > highest: highest = A[height] count += highest - A[height+1] print(count) if __name__ == '__main__': main()
p02578
s869495616
Wrong Answer
N = input() As = list(map(int, input().split())) s = 0 now = As[0] for a in As: if a<now: s += now - a else: now = a print(s)
p02578
s504573234
Wrong Answer
n = int(input()) a = list(map(int,input().split())) ans = 0 for i in range(1,n): if(a[i-1] > a[i]): while(a[i-1] == a[i]): a[i] += 1 ans += 1 print(ans)
p02578
s988380437
Wrong Answer
N=int(input()) A=list(map(int,input().split())) ans=sum(A) s=N+1 j=s sum_A=0 for i in range(N): if A==sorted(A): print(i) exit() x=max(A[:s]) s=A.index(x) A[s:j]=[x]*len(A[s:j]) j=s if s==0: break print(sum(A)-ans)
p02578
s369800628
Wrong Answer
n = int(input()) a = list(map(int, input().split())) total = 0 for i in range(1, n): if a[i-1] > a[i]: total += a[i-1] - a[i] a[i] = a[i-1]
p02578
s965443546
Wrong Answer
# t=int(input()) # for _ in range(t): n=int(input()) arr=[int(x) for x in input().split()] arr1=arr.copy() arr1.sort() count=0 for i in range(n): if arr[i] != arr1[i]: count+=1 print(count)
p02578
s274999570
Wrong Answer
n=int(input()) a=list(map(int,input().split())) m=max(a) cnt=0 for i in range(n): if a[i]!=m: cnt+=1 print(cnt)
p02578
s733360937
Wrong Answer
n = int(input()) a = list(map(int, input().split())) l = [] for i in range(len(a) - 1): if a[i + 1] < a[i]: l.append(a[i]-a[i + 1]) a[i + 1] = a[i]
p02578
s589640020
Wrong Answer
n=int(input()) A=list(map(int,input().split())) count=0 for i in range(1,len(A)): for j in range(i,0): if(a[j]<a[i]): count+=(a[i]-a[j]) else: pass print(count)
p02578
s267575011
Wrong Answer
#!/usr/local/bin/python3 N = int(input()) A = list(map(int, input().split()))[::-1] ans = 0 m = A[0] s = n = 0 for i in range(N): if A[i] <= m: ans += n*m - s s = n = 0 m = A[i] s += A[i] n += 1 print(f"result: {m}, {n}, {s}, {ans}") if A[i] <= m: ans += n*m - s print(ans)
p02578
s009769497
Wrong Answer
N = int(input()) A = list(map(int,input().split())) pre = A[0] ans = 0 for i in range(len(A)): now = A[i] if pre < now: ans += now - pre pre = now + (now-pre) else: pre = now print(ans)
p02578
s189554007
Wrong Answer
N = int(input()) L = list(map(int, input().split())) sum = 0 for i in range(N): sum += max(0, L[i-1] - L[i]) print(sum)
p02578
s788683650
Wrong Answer
N = int(input()) A = list(map(int, input().split())) print(max(A)-min(A))
p02578
s706557704
Wrong Answer
n = int(input()) a = list(map(int, input().split())) highest = 0 ans = 0 a = a[::-1] for i in a: if i > highest: highest = i ans += highest - i print(ans)
p02578
s517640268
Wrong Answer
n = int(input()) a = list(map(int,input().split())) s = 0 for i in range(n-1): e = a[i+1]-a[i] if e > 0: if e > s: s = e else: continue else: continue print(s)
p02578
s821087410
Wrong Answer
N=int(input()) A=list(map(int,input().split())) X=0 for i in range(N-1): if A[i+1]>A[i]: X+=A[i+1]-A[i] A[i+1]=A[i] print(X)
p02578
s026620591
Wrong Answer
n = int(input()) a = list(map(int, input().split())) max_int = max(a) ans = 0 for i in range(n): if i == 0 and max_int: continue elif i < max_int: ans += 1 elif max_int == a[i]: ans = 0 print(ans)
p02578
s122737321
Wrong Answer
n = int(input()) A = [*map(int, input().split())] s = 0 pre = A[0] for now in A[1:]: d = now - pre if d>0: s += d pre = now print(s)
p02578
s201317411
Wrong Answer
#_ = input() li = list(map(int,input().split())) ans=0 while li!=[] and li!=sorted(li): maxValue = max(li) print(maxValue) maxLocation = li.index(maxValue) print(maxLocation) li_removed = li[maxLocation:] li_removed.sort() print(li_removed) li = li[:maxLocation] maxLocation2 = li_removed.index(maxValue) li_calculate = li_removed[:maxLocation2] print(li_removed) print(li_calculate) for i in li_calculate: ans = ans + (maxValue - i) print(ans)
p02578
s378916801
Wrong Answer
N = int(input()) A = list(map(int,input().split())) ans = 0 for i in range(1,N): diff = A[i] - A[i - 1] if diff <= 0: pass else: ans += diff A[i] += diff print(ans)
p02578
s960614334
Wrong Answer
N = int(input()) A_high_list = list(map(int,input().split())) B_list = [A_high_list[0]] Fumidai = 0 s = 0 for n in range(N): if B_list[n] > A_high_list[n]: s = max(B_list) - A_high_list[n] Fumidai += s B_list.append(A_high_list[n]) else: B_list.append(A_high_list[n]) continue print(Fumidai)
p02578
s094502282
Wrong Answer
n = int(input()) a = list(map(int, input().split())) ans = 0 for i, h in enumerate(a): if i == 0: continue ans += max(0, a[i - 1] - h) print(ans)
p02578
s685913452
Wrong Answer
n = int(input()) l = list(map(int,input().split())) #print(n,l) ans=0 l2=[l[0]] #print(l2) for i in range(1,n): if l[i-1] <= l[i]: l2+=[l[i]] continue else: l2+=[l2[i-1]] ans+=(l2[i]-l[i]) print(ans)
p02578
s990785264
Wrong Answer
N = int(input()) A = list(map(int, input().split())) sum=0 sa = 0 for i in range(N-1): if A[i] <= A[i+1]: continue else: sa = A[i]-A[i+1]+1 A[i+1]=A[i]+1 sum += sa print(sa)
p02578
s752834587
Wrong Answer
n = int(input()) a = list(map(int, input().split())) maxi = a[0] ans = 0 for i in range(1, n): if a[i - 1] > a[i]: ans += maxi - a[i] else: maxi = a[i] print(ans)
p02578
s081647696
Wrong Answer
N = int(input()) A = list(map(int, input().split())) ans = 0 for i in range(1, N): ans += max(0, A[i] - A[i-1]) print(ans)