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
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≤
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.
Step by step
Solved in 3 steps with 1 images