TopSetter is an organization that creates problems. They’ve prepared N problems with estimated difficulty score in range [ $A_i , B_i$ ]. TopHoster would like to host a contest consisting of M problems.
The $i^{th}$ problem should be of difficulty score $C_i$. The $i^{th}$ problem from TopSetter can be used in the contest if and only if its estimated difficulty score range $[A_i, B_i]$ covers the difficulty score c of its target problem in the contest, i.e. $A_i ≤ c ≤ B_i$ . Hosting a contest with M problems needs tohave M distinct problems which satisfy the required difficulty scores for each problem.
Unfortunately, TopSetter doesn’t provide a service to buy specific problems. You can only request a problem set containing K problems and they will give you K distinct problems from all the N problems, but you don’t know which problems will be given.
As TopSetter is the only problem provider for TopHoster, TopHoster would like to know the least number K of problems they need to buy to make sure they can host a contest.