SP116 INTERVAL - Intervals
Description
You are given n closed integer intervals \[a $ _{i} $ , b $ _{i} $ \] and n integers c $ _{1} $ , ..., c $ _{n} $ .
### Task
Write a program that:
- reads the number of intervals, their endpoints and integers c $ _{1} $ , ..., c $ _{n} $ from the standard input,
- computes the minimal size of a set Z of integers which has at least c $ _{i} $ common elements with interval \[a $ _{i} $ , b $ _{i} $ \], for each i = 1, 2, ..., n,
- writes the answer to the standard output.
Input Format
The input begins with the integer t, the number of test cases. Then t test cases follow.
For each test case the first line of the input contains an integer n (1
Output Format
For each test case the output contains exactly one integer equal to the minimal size of set Z sharing at least c $ _{i} $ elements with interval \[a $ _{i} $ , b $ _{i} $ \], for each i= 1, 2, ..., n.