Company: Deshaw_16sep
Difficulty: medium
Passenger Processing Times Problem Description An airport has exactly one security scanner. It can be used either for arrivals or for departures, but it serves only one passenger at a time. Sometimes many passengers reach the scanner at about the same time with different travel directions. There are n passengers, numbered 0 to n - 1 . Passenger i arrives at the scanner at second time[i] and wants to go to departures if direction[i] = 1 , or to arrivals if direction[i] = 0 . Passengers form two lines, one for departures and one for arrivals. Within each line, passengers are ordered by the time they arrived at the scanner and, if those times are equal, by passenger number (smaller number first). Passing through the scanner takes exactly 1 second, and at most one passenger passes through in any second. In every second in which at least one passenger is waiting, the scanner is used by the passenger at the front of one of the two lines. If only one line has someone waiting, the front passen