Optimized solution

The big game There are two teams T1 and T2 playing a game. Both the teams have players. The power of each player of TI is represented in an array. Similarly, the power of each player of T2 is represented in an array. The rules of this game are as follows: • There are only N fights. • No player from any team can play twice. • At an instance in time, only one fight can occur. • For each fight, the score generated is (P1 + P2%N, where P1 represents the power of a player from team Ti and P2 represents the power of a player from team T2. T2 is oware of the order in which T1 is sending their players to play the game. T2 wants to obtain a minimum score for each fight. Your task is to determine the order in which T2 must send their players such that they obtain a minimum score for each fight. You are required to print the score for each round and the order of the players of T2. Example Consider that T1 and T2 have 3 players each (…N-3). Also, consider that the power of the players of T1 and T2 (represented in an array) is as follows: . 11. 11. 2. 31 • T2 = 12.0.11 First, you are required to decide the order of the players for T2 and then determine the score for each round. If you consider the order as T2 =(2, 1, 0), then the score generated from the provided formulae is as follows: IMT + 2)%3.2+1)%3. (3+0)% 3) = [0, 0, 0 . First, you are required to decide the order of the players for T2 and then determine the score for each round. If you consider the order as T2 = 12. 1.0), then the score generated from the provided formulae is as follows: • 12+2)%3.(2+1)%3.13 + 0)% 3) = [0, 0, 0] You must obtain the minimum score for each fight. Therefore, the minimum score for each fight is (0.0.0, Function description Complete the solve function provided in the editor. This function takes the following 3 parameters and returns the score for each round after deciding the order of the players for T2: • N. Represents the number of players • TE Represents an array that denotes the power of the players of T1 • T2 Represents an array that denotes the power of the players of T2 Input format Note: This is the input format that you must use to provide custom Input (avaliable above the Compile and Test button) • The first line contains T denoting the number of test cases. Talso denotes the number of times you have to run the solve function on a different set or inputs. . The first line of each test case contains a number N representing the number of players in a team. • The second line contains N space-separated Integers denoting the Tarray that contains the powers of the players from Tt in the order that they will send their players in the game to fight • The third line contains N space-separated integers deonting the T2 array that contains the powers of the players from T2 Output format For each test case, print N space-separated Integers representing the score for each round after deciding the order of the players for T2 Output format For each test case, print N space-separated Integers representing the score for each round after deciding the order of the players for T2. Note. For each test case, print the answer in a new line, Code snippets (also called starter code/boilerplate code) This question has code snippets for C, CPP, Java, and Python Constraints 1ST’S 10 IS NS 105 OST1721] <N.Vie {1.2…N} Sample Input 1 Copy Sample output 1 Copy 1002 0121 Explanation Explanation In First round T1 will send their first person with o power to get minimum possible score T2 will send their ard person having power 1. So the score is (0+1784 = 1 In Second round T1 will send their second person with power to get minimum possible score T2 will send their 1st person having power 3. So the score is 11.3764-0 In third round TI will send their third person with 2 power to get minimum possible score T2 will send their 2nd person having power 2. So the score is (2+2/%4 0. In Fourth round Tt will send their fourth person with power to get minimum possible score T2 will send their 4th person having power 1. So the scores (1784 Note: Your code must be able to print the sample output from the provided an input However your code is run against multiple diden tests. Therefore your code must pass these hidden test Colve the problemoment