82 274
Assignments Done
99,5%
Successfully Done
In January 2020

# Answer to Question #41390 in C++ for liora

Question #41390
Panda Yuan has many fans, everyone wants to see her. Thus, NTHU decides to hold a fan meeting for her in gym. Since the number of fans are so numerous, to make the activity run smoothly, fans are divided into three groups: group A, group B, group C. For a given order, a fan from group A will be inserted into the head (order 0) of the waiting line, a fan from group B will be inserted into the middle (order length/2 ex: length=3, insert in order 1 ) of the waiting line, a fan from group C will be inserted into the tail (order length) of the waiting line. After fans are all lined up, some fans are luckily chosen to have a chance to leave the waiting line and take pictures with Panda Yuan while others are still queueing. The rule of activities are too complex to calculate, can you help NTHU memorizes the infromation of remaining fans in the waiting line (order 0 to length-1) ? There are ten testcases in the assignment, 10% for eachInput The first line contains an integer, the number of test cases. Each test case is in the following format. The first line of the input contains an integer N (1 &lt;= N &lt;= 10000) denoting the number of fans. The following N line contains the information of each fans, which includes the number K (1 &lt;= K &lt;= 10000), the group G (A or B or C) and the name S (length of S is less then 30). You may simply assume the information of each fans is unique. Next line contains another integer L (0 &lt;= L &lt;= N) represents the number of lucky fans. The following L lines contain the name of fans. Output For each case, separately print out the information of each fan from head to tail before and after the lucky fans are chosen. Format can be found in Sample Output. For &quot;Before&quot; part, you should print all fans include lucky fans, &quot;After&quot; part you should print all fans without lucky fans. If there is no one in line, print null instead.Sample Input 2 4 1 A Ma 2 A Wang 3 C Angela 5 B Amber 2 Wang Amber 2 99 A Eric 100 B Yoshi 2 Eric Yoshi Sample Output Before: 2 A Wang 5 B Amber 1 A Ma 3 C Angela After: 1 A Ma 3 C Angela Before: 100 B Yoshi 99 A Eric After: null
1
2014-04-18T11:59:20-0400
Dear customer,
Please submit it with all requirements as an assignment to our control panel and
we&#039;ll assist you.

Need a fast expert's response?

Submit order

and get a quick answer at the best price

for any assignment or question with DETAILED EXPLANATIONS!