Loading problem...
An airline reservation platform needs to compute real-time ticket outcomes for each booking event.
Table: Flights
Table: Passengers
Seat allocation policy:
Task: Return each passenger with their booking status.
Output requirements:
Supported submission environments:
Flights:
| flight_id | capacity |
|-----------|----------|
| 1 | 2 |
| 2 | 2 |
| 3 | 1 |
Passengers:
| passenger_id | flight_id | booking_time |
|--------------|-----------|----------------------|
| 101 | 1 | 2023-07-10 16:30:00 |
| 102 | 1 | 2023-07-10 17:45:00 |
| 103 | 1 | 2023-07-10 12:00:00 |
| 104 | 2 | 2023-07-05 13:23:00 |
| 105 | 2 | 2023-07-05 09:00:00 |
| 106 | 3 | 2023-07-08 11:10:00 |
| 107 | 3 | 2023-07-08 09:10:00 |[
{"passenger_id":101,"Status":"Confirmed"},
{"passenger_id":102,"Status":"Waitlist"},
{"passenger_id":103,"Status":"Confirmed"},
{"passenger_id":104,"Status":"Confirmed"},
{"passenger_id":105,"Status":"Confirmed"},
{"passenger_id":106,"Status":"Waitlist"},
{"passenger_id":107,"Status":"Confirmed"}
]Flight 1 confirms the earliest two bookings and waitlists the third. Flight 2 has exactly two bookings for two seats. Flight 3 has one seat, so the earlier booking is confirmed and the later booking is waitlisted.
Flights:
| flight_id | capacity |
|-----------|----------|
| 10 | 1 |
| 20 | 3 |
Passengers:
| passenger_id | flight_id | booking_time |
|--------------|-----------|----------------------|
| 1001 | 10 | 2024-01-01 08:00:00 |
| 1002 | 10 | 2024-01-01 08:00:05 |
| 2001 | 20 | 2024-02-02 09:10:00 |
| 2002 | 20 | 2024-02-02 09:11:00 |[
{"passenger_id":1001,"Status":"Confirmed"},
{"passenger_id":1002,"Status":"Waitlist"},
{"passenger_id":2001,"Status":"Confirmed"},
{"passenger_id":2002,"Status":"Confirmed"}
]Flight 10 can confirm only one booking. Flight 20 has capacity for all present bookings.
Flights:
| flight_id | capacity |
|-----------|----------|
| 70 | 2 |
Passengers:
| passenger_id | flight_id | booking_time |
|--------------|-----------|----------------------|
| 7001 | 70 | 2024-04-03 07:00:00 |
| 7002 | 70 | 2024-04-03 07:05:00 |
| 7003 | 70 | 2024-04-03 07:10:00 |
| 7004 | 70 | 2024-04-03 07:20:00 |[
{"passenger_id":7001,"Status":"Confirmed"},
{"passenger_id":7002,"Status":"Confirmed"},
{"passenger_id":7003,"Status":"Waitlist"},
{"passenger_id":7004,"Status":"Waitlist"}
]Only the first two bookings fit into capacity. Remaining passengers are waitlisted.
Constraints