Submission #1059453

#TimeUsernameProblemLanguageResultExecution timeMemory
1059453Roumak77Self Study (JOI22_ho_t2)Cpython 3
0 / 100
9 ms2912 KiB
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 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...