Company: Dezerv
Difficulty: medium
Seat reservation A movie theater has N seats, numbered 1 to N . Every seat starts out unreserved. The box office processes K operations, one after another. Operation i is described by a single integer seat[i] : seat[i] = 0 — a customer asks for a seat. The system hands out the smallest-numbered seat that is currently unreserved and marks it reserved. (The seat number handed to the customer is not reported.) seat[i] > 0 — the reservation for seat number seat[i] is cancelled. That seat becomes unreserved again and may be handed out by a later request, exactly like any other free seat. After all K operations have been processed, report every seat that is still reserved. Input Format The first line contains two space-separated integers N and K — the number of seats and the number of operations. Each of the next K lines contains a single integer seat[i] — the i -th operation, in the order it is processed. (inferred — the source describes the input only as the parameters N , K and an arra