A[] and B[], containing departure times from A and B, plus an integer m representing the number of missions.current_time = 0 before the first mission.current_time; travel to B in 100 time units; at B, wait for the first departure that is at least the arrival time; then spend another 100 time units traveling back to A. If no departure is available at A or B, the mission cannot complete.A = [5, 80, 260, 470], B = [110, 250, 430, 850], m = 2
Mission 1: leave A at 5 → reach B at 105 → first B departure ≥ 105 is 110 → reach A at 210
Mission 2: first A departure ≥ 210 is 260 → reach B at 360 → first B departure ≥ 360 is 430 → reach A at 530
Output: 530
The result is 530 because the second round trip returns to A at that time.