Submission #632611

# Submission time Handle Problem Language Result Execution time Memory
632611 2022-08-20T12:32:28 Z karolb2011 Potatoes and fertilizers (LMIO19_bulves) Python 3
0 / 100
1000 ms 65292 KB
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
    w+=abs(p)
    t+=abs(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 time Memory Grader output
1 Correct 12 ms 2772 KB Output is correct
2 Correct 18 ms 2952 KB Output is correct
3 Correct 18 ms 3104 KB Output is correct
4 Correct 130 ms 8572 KB Output is correct
5 Correct 238 ms 14296 KB Output is correct
6 Correct 505 ms 33452 KB Output is correct
7 Execution timed out 1012 ms 65292 KB Time limit exceeded
8 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 12 ms 2772 KB Output is correct
2 Correct 18 ms 2952 KB Output is correct
3 Correct 18 ms 3104 KB Output is correct
4 Correct 130 ms 8572 KB Output is correct
5 Correct 238 ms 14296 KB Output is correct
6 Correct 505 ms 33452 KB Output is correct
7 Execution timed out 1012 ms 65292 KB Time limit exceeded
8 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 12 ms 2772 KB Output is correct
2 Correct 18 ms 2952 KB Output is correct
3 Incorrect 14 ms 2844 KB Output isn't correct
4 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 12 ms 2772 KB Output is correct
2 Correct 18 ms 2952 KB Output is correct
3 Correct 18 ms 3104 KB Output is correct
4 Incorrect 14 ms 2844 KB Output isn't correct
5 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 12 ms 2772 KB Output is correct
2 Correct 18 ms 2952 KB Output is correct
3 Correct 18 ms 3104 KB Output is correct
4 Incorrect 14 ms 2844 KB Output isn't correct
5 Halted 0 ms 0 KB -