------
## 最终结论
```python
def minimum_time_to_get_dishes(t, test_cases):
    results = []
    for case in test_cases:
        n, a, b = case
        total_b_time = sum(b)
        min_time = float('inf')
        current_b_time = 0

        for i in range(n):
            total_b_time -= b[i]
            min_time = min(min_time, max(a[i], current_b_time + total_b_time))
            current_b_time += b[i]

        results.append(min_time)

    return results

# Example usage:
t = 4
test_cases = [
    (4, [3, 7, 4, 5], [2, 1, 2, 4]),
    (4, [1, 2, 3, 4], [3, 3, 3, 3]),
    (2, [1, 2], [10, 10]),
    (2, [10, 10], [1, 2])
]

print(minimum_time_to_get_dishes(t, test_cases))
```