Submission #632621

# Submission time Handle Problem Language Result Execution time Memory
632621 2022-08-20T12:48:10 Z karolb2011 Potatoes and fertilizers (LMIO19_bulves) Python 3
24 / 100
1000 ms 22812 KB
import sys
input = sys.stdin.readline
n=int(input())
w=0
t=0
p=0
s=[]
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-t)
if p>0:
    for i in range(n):
        w=min(w,s[i]+t)
print(w)
# Verdict Execution time Memory Grader output
1 Correct 13 ms 2772 KB Output is correct
2 Correct 17 ms 2896 KB Output is correct
3 Correct 18 ms 2992 KB Output is correct
4 Correct 101 ms 4864 KB Output is correct
5 Correct 193 ms 6864 KB Output is correct
6 Correct 503 ms 12808 KB Output is correct
7 Correct 875 ms 22684 KB Output is correct
8 Correct 864 ms 22688 KB Output is correct
9 Correct 900 ms 22812 KB Output is correct
10 Correct 840 ms 19760 KB Output is correct
11 Correct 791 ms 22680 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 13 ms 2772 KB Output is correct
2 Correct 17 ms 2896 KB Output is correct
3 Correct 18 ms 2992 KB Output is correct
4 Correct 101 ms 4864 KB Output is correct
5 Correct 193 ms 6864 KB Output is correct
6 Correct 503 ms 12808 KB Output is correct
7 Correct 875 ms 22684 KB Output is correct
8 Correct 864 ms 22688 KB Output is correct
9 Correct 900 ms 22812 KB Output is correct
10 Correct 840 ms 19760 KB Output is correct
11 Correct 791 ms 22680 KB Output is correct
12 Correct 270 ms 7876 KB Output is correct
13 Correct 625 ms 14908 KB Output is correct
14 Execution timed out 1086 ms 22640 KB Time limit exceeded
15 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 13 ms 2772 KB Output is correct
2 Correct 17 ms 2896 KB Output is correct
3 Incorrect 12 ms 2744 KB Output isn't correct
4 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 13 ms 2772 KB Output is correct
2 Correct 17 ms 2896 KB Output is correct
3 Correct 18 ms 2992 KB Output is correct
4 Incorrect 12 ms 2744 KB Output isn't correct
5 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 13 ms 2772 KB Output is correct
2 Correct 17 ms 2896 KB Output is correct
3 Correct 18 ms 2992 KB Output is correct
4 Incorrect 12 ms 2744 KB Output isn't correct
5 Halted 0 ms 0 KB -