Submission #632614

#TimeUsernameProblemLanguageResultExecution timeMemory
632614karolb2011Potatoes and fertilizers (LMIO19_bulves)Cpython 3
24 / 100
1085 ms65120 KiB
import sys input = sys.stdin.readline n=int(input()) w=0 t=0 p=0 s=[] r=[] for i in range(n): pi,bi=list(map(int,input().split())) p+=pi-bi if p>=1: w+=p t+=p-1 else: w-=p t-=p-1 s.append(w) r.append(t) if p>0: for i in range(n): w=min(w,s[i]-r[i]+t) print(w)
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...