People are lining for shu cream. To make sure the customer won't be waiting too long, the shu cream store decided to serve multiple people at the same time. The number of people that the store can serve simultaneously is call the window size S. The lining queue will be divided into serveral windows accroding to the window size, where the people in the same window can be served at the same time.
For example, if the current queue is [1, 2, 3, 4, 5, 6, 7, 8] and S=2, then each window will be: [1, 2], [3, 4], [5, 6], [7, 8]. Similarly, if S=3, then each window will be [1, 2, 3], [4, 5, 6], [7, 8].
Now, you need to implement a data structure WindowedQueue to simulate the lining queue, which supports the following operations:
SET_WIN_SIZE S: Set the new window size to S INSERT ID: Add a new customer ID to the end of queue, where ID is an integer.SERVE: Serve the customers in the first window and print out the customers that is served. After that, these customers will be removed from the queue, and the customers in the seoncd window will be promoted to the first window, and so on. For example, suppose that the current queue is [1, 2, 3, 4, 5, 6, 7, 8] and the window size is 3. After a SERVE operation, customers [1, 2, 3] is removed from the queue, and the second window [4, 5, 6] will become the first window. Similarly, the third window [7, 8] will become the second window.LEN: Print the number of windows.SHOW_QUEUE k: Print the first k windowsInitially, the queue is empty and the window size is set to 2.
Given the template:
The first line contains an integer T (T <= 1000), representing the number of operations
For the next T lines, each line contain one of an operation above.
The constraints of each operations:
SET_WIN_SIZE S: S <= 1000 INSERT ID: ID <= 1000SERVE: No extra contraintLEN: No extra contraintSHOW_QUEUE k: k is guaranteed to be less than or equal to the number of windowsFor each following operation, output the corresponding text:
SERVE: Output Serve customers: , followed by a list of ID of customers in the first window. If the queue is empty, output No customer to be servedLEN: Output an integer, representing the number of windows.SHOW_QUEUE k: Output k lists, the i-th list indicates the IDs of customers in the i-th window.