Submission #1059453

# Submission time Handle Problem Language Result Execution time Memory
1059453 2024-08-15T01:35:09 Z Roumak77 Self Study (JOI22_ho_t2) Python 3
0 / 100
9 ms 2912 KB
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
1 Incorrect 9 ms 2908 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 8 ms 2908 KB Output is correct
2 Correct 8 ms 2908 KB Output is correct
3 Correct 8 ms 2908 KB Output is correct
4 Correct 9 ms 2908 KB Output is correct
5 Correct 8 ms 2908 KB Output is correct
6 Correct 8 ms 2908 KB Output is correct
7 Incorrect 9 ms 2912 KB Output isn't correct
8 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 9 ms 2908 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 8 ms 2908 KB Output is correct
2 Correct 8 ms 2908 KB Output is correct
3 Correct 8 ms 2908 KB Output is correct
4 Correct 9 ms 2908 KB Output is correct
5 Correct 8 ms 2908 KB Output is correct
6 Correct 8 ms 2908 KB Output is correct
7 Incorrect 9 ms 2912 KB Output isn't correct
8 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 9 ms 2908 KB Output isn't correct
2 Halted 0 ms 0 KB -