PROBLEM STATEMENT The output of a multithreaded system can be quite garbled, due to the interleaved execution that occurs. In this problem, we will model such a situation. Each thread's output will be described by a string. For example, the string "AB" would mean that after 1 time unit running, the thread would print an 'A'. After another time unit it would print a 'B'. After a third time unit, it would print an 'A' (wraps back to the beginning). You will be given a vector describing the threads to be run. You will also be given a vector containing the time slices each thread is given. Each element of slices will have the form "Thread# Time". Thread# is a 0-based index into threads. Time is how many units of time the thread in question will execute for. The elements of slices occur in the order they will be run. If a thread is executed, and then executed again at a later point, it starts where it left off (see examples for further clarification). You will return a string containing the output in the order it occurred. For example, if threads = {"AB","CD"} slices = {"0 1","1 1","0 1","1 2"} Then you would return "ACBDC". DEFINITION Class:PrintScheduler Method:getOutput Parameters:vector , vector Returns:string Method signature:string getOutput(vector threads, vector slices) CONSTRAINTS -threads will contain between 1 and 50 elements inclusive. -Each element of threads will contain between 1 and 50 characters inclusive. -Each character in each element of threads will be a capital letter. -slices will contain between 1 and 50 elements inclusive. -Each element of slices will have the form "Thread# Time". Thread# will be an integer, without extra leading zeros, between 0 and k-1 inclusive, where k is the number of elements in threads. Time will be an integer, without leading zeros, between 1 and 50 inclusive. EXAMPLES 0) {"AB","CD"} {"0 1","1 1","0 1","1 2"} Returns: "ACBDC" From the problem statement. The output occurs as follows: Thread 0 - Runs for 1 unit - Outputs "A" Thread 1 - Runs for 1 unit - Outputs "C" Thread 0 - Runs for 1 unit - Outputs "B" Thread 1 - Runs for 2 units - Outputs "DC" 1) {"ABCDE"} {"0 20","0 21"} Returns: "ABCDEABCDEABCDEABCDEABCDEABCDEABCDEABCDEA" 2 long time slices. 2) {"A","B"} {"1 10","0 1","1 10","0 2"} Returns: "BBBBBBBBBBABBBBBBBBBBAA" 3) {"A"} {"0 1"} Returns: "A" This problem statement is the exclusive and proprietary property of TopCoder, Inc. Any unauthorized use or reproduction of this information without the prior written consent of TopCoder, Inc. is strictly prohibited. (c)2010, TopCoder, Inc. All rights reserved.