Online Judge | Problem Set | Authors | Online Contests | User | ||||||
---|---|---|---|---|---|---|---|---|---|---|
Web Board Home Page F.A.Qs Statistical Charts | Current Contest Past Contests Scheduled Contests Award Contest |
Language: The Downloading Task
Description A download software can execute multiple tasks simultaneously. For each task, there might be four states: downloading, waiting, paused, or finished. And there can be at most n tasks with state downloading at the same time. At the very beginning, the software has no tasks. Then it will receive m pieces of instructions. The forms of instructions are as listed below:
Now you need to program to simulate the download software, output the state of all the tasks according to the final priority after it has executed all the m pieces of instructions. Assumption: Any two different tasks have different names. The task described in the New instruction has never existed before. The task described in the Pause instruction is either waiting or downloading. The task described in the Continue instruction is paused. The task described in the Finish instruction is downloading. Input The first line of the input is an integer T which indicates the number of test cases. For each test case, the first line are two integers n (1 ≤ n ≤ 10000) and m (1 ≤ m ≤ 100000), then m lines of instructions in the forms as described above. In the instructions, names are strings contain either letters or figures with length no greater than 10. Output For each test case, output all the tasks' states according to the final priority, each task a line. Print a blank line after each test case. Sample Input 3 10 1 New name 1 5 New a New b New B Pause a Finish B 2 10 New aa New bb New cc Pause aa New dd Continue aa New ee Finish cc Sort desc Pause bb Sample Output name downloading B finished a paused b downloading ee downloading dd waiting cc finished bb paused aa downloading Source |
[Submit] [Go Back] [Status] [Discuss]
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator