Focuses got by hopefuls in various stages are utilized for shaping generally challenge results. Assume that k phases of the challenge are finished. For every challenger, k−⌊k4⌋ stages with the most noteworthy scores are chosen, and these scores are added up. This total is the general aftereffect of the competitor. (Here ⌊t⌋ indicates adjusting t down.)    For instance, assume

Database System Concepts
7th Edition
ISBN:9780078022159
Author:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Chapter1: Introduction
Section: Chapter Questions
Problem 1PE
icon
Related questions
Question
100%

Correct answer will be upvoted else downvoted.

 

Focuses got by hopefuls in various stages are utilized for shaping generally challenge results. Assume that k phases of the challenge are finished. For every challenger, k−⌊k4⌋ stages with the most noteworthy scores are chosen, and these scores are added up. This total is the general aftereffect of the competitor. (Here ⌊t⌋ indicates adjusting t down.) 

 

For instance, assume 9 phases are finished, and your scores are 50,30,50,50,100,10,30,100,50. Initial, 7 phases with the most elevated scores are picked — for instance, all stages aside from the 2-nd and the 6-th can be picked. Then, at that point, your general outcome is equivalent to 50+50+50+100+30+100+50=430. 

 

At this point, n stages are finished, and you know the focuses you and Ilya got for these stages. Be that as it may, it is obscure the number of more stages will be held. You can't help thinking about what the most modest number of extra stages is, after which your outcome may become more prominent than or equivalent to Ilya's outcome, from a certain perspective. Track down this number! 

 

Input 

 

Each test contains different experiments. The primary line contains the number of experiments t (1≤t≤1000). Depiction of the experiments follows. 

 

The primary line of each experiment contains a solitary integer n (1≤n≤105) — the number of finished stages. 

 

The subsequent line contains n integers a1,a2,… ,an (0≤ai≤100) — your focuses for the finished stages. 

 

The third line contains n integers b1,b2,… ,bn (0≤bi≤100) — Ilya's focuses for the finished stages. 

 

It is ensured that the amount of n over all experiments doesn't surpass 105. 

 

Output 

 

For each experiment print a solitary integer — the most modest number of extra stages needed for your outcome to have the option to become more prominent than or equivalent to Ilya's outcome.

Expert Solution
steps

Step by step

Solved in 3 steps with 1 images

Blurred answer
Similar questions
  • SEE MORE QUESTIONS
Recommended textbooks for you
Database System Concepts
Database System Concepts
Computer Science
ISBN:
9780078022159
Author:
Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:
McGraw-Hill Education
Starting Out with Python (4th Edition)
Starting Out with Python (4th Edition)
Computer Science
ISBN:
9780134444321
Author:
Tony Gaddis
Publisher:
PEARSON
Digital Fundamentals (11th Edition)
Digital Fundamentals (11th Edition)
Computer Science
ISBN:
9780132737968
Author:
Thomas L. Floyd
Publisher:
PEARSON
C How to Program (8th Edition)
C How to Program (8th Edition)
Computer Science
ISBN:
9780133976892
Author:
Paul J. Deitel, Harvey Deitel
Publisher:
PEARSON
Database Systems: Design, Implementation, & Manag…
Database Systems: Design, Implementation, & Manag…
Computer Science
ISBN:
9781337627900
Author:
Carlos Coronel, Steven Morris
Publisher:
Cengage Learning
Programmable Logic Controllers
Programmable Logic Controllers
Computer Science
ISBN:
9780073373843
Author:
Frank D. Petruzella
Publisher:
McGraw-Hill Education