can pay one dollar to the sock store to all things considered:    recolor a sock to any tone c′ (1≤c′≤n)    transform a left sock into a right sock    transform a right sock into a left sock    The sock store might play out every one of these progressions

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

Computer science. Correct answer will be upvoted else downvoted.

 

Phoenix can pay one dollar to the sock store to all things considered: 

 

recolor a sock to any tone c′ (1≤c′≤n) 

 

transform a left sock into a right sock 

 

transform a right sock into a left sock 

 

The sock store might play out every one of these progressions quite a few times. Note that the shade of a left sock doesn't change when it transforms into a right sock, as well as the other way around. 

 

A coordinating with pair of socks is a left and right sock with a similar shading. What is the base expense for Phoenix to make n/2 coordinating with sets? Each sock should be remembered for precisely one coordinating with pair. 

 

Input 

 

The input comprises of numerous experiments. The principal line contains an integer t (1≤t≤1000) — the number of experiments. 

 

The primary line of each experiment contains three integers n, l, and r (2≤n≤2⋅105; n is even; 0≤l,r≤n; l+r=n) — the all out number of socks, and the number of left and right socks, separately. 

 

The following line contains n integers ci (1≤ci≤n) — the shades of the socks. The primary l socks are left socks, while the following r socks are correct socks. 

 

It is ensured that the amount of n across all the experiments won't surpass 2⋅105. 

 

Output 

 

For each experiment, print one integer — the base expense for Phoenix to make n/2 coordinating with sets. Each sock should be remembered for precisely one coordinating with pair.

Expert Solution
steps

Step by step

Solved in 3 steps with 1 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