Question
language : C Minions Legends is a multiplayer online battle arena (MOBA) mobile game. In this game, each player will be grouped with another player
language : C
Minions Legends is a multiplayer online battle arena (MOBA) mobile game. In this game, each player will be grouped with another player to form a team. The team will fight another team to defend their sacred ancient and to destroy their opponents base. In the next patch, the developers of the game want to create a simple party finding algorithm which can match two players based on their matchmaking rating (MMR). In their implementation, a player will be grouped with the player with the lowest MMR that is higher than their MMR. If a player has the highest MMR, they will be grouped with the player with the highest MMR that is lower than their MMR.
Format Input : The first line contains integer K which denote as the number of cases. The second line contains integer N stating the total number of players. Then, the third line consists of N MMR in the game. Lastly, the fourth line contains of F which denote as the players MMR who wants to find a party. It is guaranteed that the MMR are distinct.
Format Output : Output with a format CASE #K: [MMR 1] [MMR 2]; where MMR 1 and MMR 2 are the result of party finding. Note that MMR 1 is the one with the lower MMR compared to MMR 2. If the inputted MMRs number is not in the list of players, give an output CASE #K: -1 -1.
Constraints : 1 K 100 2 N 1000 3000 MMR 9999 3000 F 9999
Sample Input 1 (standard input) : 3 10 3246 4255 4873 5004 5095 6001 6692 7100 7610 9712 9712 8 4957 5444 5464 5634 6149 6622 8313 9492 4957 6 5393 6021 7233 8115 8118 9304 9999
Sample Output 1 (standard output) : CASE #1: 7610 9712 CASE #2: 4957 5444 CASE #3: -1 -1
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started