This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#!/usr/bin/env python3
n = int(input())
x = [int(i) for i in input().split()]
y = [int(i) for i in input().split()]
good, okay, bad, free = 0, 0, 0, 0
for i in range(n):
k = min(y[i], free)
free -= k
y[i] -= k
good += k
k = min(y[i], okay)
okay -= k
bad += k
good += k
y[i] -= k
k = min(y[i], x[i])
okay += k
y[i] -= k
x[i] -= k
free += x[i]
bad += y[i]
print(good - bad)
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |