Party Finding Minions Lege

Computer Networking: A Top-Down Approach (7th Edition)
7th Edition
ISBN:9780133594140
Author:James Kurose, Keith Ross
Publisher:James Kurose, Keith Ross
Chapter1: Computer Networks And The Internet
Section: Chapter Questions
Problem R1RQ: What is the difference between a host and an end system? List several different types of end...
icon
Related questions
Question

Simple Party Finding

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 opponent’s 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 player’s 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 MMR’s 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

NOTES : In C Language

Use basic code, dont use return, void, ect.

Dont Use Stdlib.h library, use basic code

Pay attention to constraints

Expert Solution
steps

Step by step

Solved in 2 steps with 5 images

Blurred answer
Recommended textbooks for you
Computer Networking: A Top-Down Approach (7th Edi…
Computer Networking: A Top-Down Approach (7th Edi…
Computer Engineering
ISBN:
9780133594140
Author:
James Kurose, Keith Ross
Publisher:
PEARSON
Computer Organization and Design MIPS Edition, Fi…
Computer Organization and Design MIPS Edition, Fi…
Computer Engineering
ISBN:
9780124077263
Author:
David A. Patterson, John L. Hennessy
Publisher:
Elsevier Science
Network+ Guide to Networks (MindTap Course List)
Network+ Guide to Networks (MindTap Course List)
Computer Engineering
ISBN:
9781337569330
Author:
Jill West, Tamara Dean, Jean Andrews
Publisher:
Cengage Learning
Concepts of Database Management
Concepts of Database Management
Computer Engineering
ISBN:
9781337093422
Author:
Joy L. Starks, Philip J. Pratt, Mary Z. Last
Publisher:
Cengage Learning
Prelude to Programming
Prelude to Programming
Computer Engineering
ISBN:
9780133750423
Author:
VENIT, Stewart
Publisher:
Pearson Education
Sc Business Data Communications and Networking, T…
Sc Business Data Communications and Networking, T…
Computer Engineering
ISBN:
9781119368830
Author:
FITZGERALD
Publisher:
WILEY