Queue Check-in Simulation with Capacity Limit
Complete the function below. The function receives the full standard input as a single string and must return the exact standard output lines for the described problem.
Original prompt
Problem
There is a single check-in line. You are given an integer array arrivalTimes where arrivalTimes[i] is the time when person i arrives at the end of the line.
Rules:
Only one person is processed at a time. The person at the front takes 30 seconds to check in. When a person arrives, if the number of people currently waiting/being served in the system is greater than 10, that person leaves immediately and will not check in.
Return an array result:
If person i is served, result[i] is the time they start service. Otherwise, result[i] = null.
Assume arrivalTimes is non-decreasing; ties are enqueued in input order.
Input
Integer array arrivalTimes
Output
Array result (each entry is an integer or null) Constraints (suggested) 1 <= len(arrivalTimes) <= 2e5 0 <= arrivalTimes[i] <= 1e9
Examples
arrival=[0,0,0] → result=[0,30,60] arrival=[0,10,20] → result=[0,30,60] arrival=[0,100] → result=[0,100] 12 people arrive at time 0 → first 11 served, 12th leaves arrival=[0,15,15,16] → result=[0,30,60,90]
Complete solveOneQueueCheckInSimulation. It has one parameter, String input, containing the full stdin payload. Return the stdout payload as an array of lines, without trailing newline characters.
1Example 1
The returned string must match the expected standard output for the sample input.
Constraints
Limits and guarantees your solution can rely on.
Use the limits and requirements stated in the prompt.