이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
import math
def solve():
n, m = map(int, input().split())
list_1 = list(map(int, input().split()))
list_2 = list(map(int, input().split()))
curr_max = 0
for i in range(n):
curr_max = max(curr_max, max(list_2[i], list_1[i]))
l, r = 0, m * n * curr_max
while l + 1 < r:
mid = (l + r) // 2
total = 0
for i in range(n):
if list_1[i] > list_2[i]:
if m * list_1[i] < mid:
total += m
total += math.ceil((mid - m * list_1[i]) / list_2[i])
else:
total += math.ceil(mid / list_1[i])
else:
total += math.ceil(mid / list_2[i])
if total > m * n:
r = mid
else:
l = mid
print(l)
solve()
# | 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... |