{"trustable":true,"sections":[{"title":"","value":{"format":"HTML","content":"Bessie noted that although humans have many universities they can attend, cows have none. To remedy this problem, she and her fellow cows formed a new university called The University of Wisconsin-Farmside,\"Moo U\" for short.\r\u003cbr\u003e\r\u003cbr\u003eNot wishing to admit dumber-than-average cows, the founders created an incredibly precise admission exam called the Cow Scholastic Aptitude Test (CSAT) that yields scores in the range 1..2,000,000,000.\r\u003cbr\u003e\r\u003cbr\u003eMoo U is very expensive to attend; not all calves can afford it.In fact, most calves need some sort of financial aid (0 \u0026lt;\u003d aid \u0026lt;\u003d100,000). The government does not provide scholarships to calves,so all the money must come from the university\u0027s limited fund (whose total money is F, 0 \u0026lt;\u003d F \u0026lt;\u003d 2,000,000,000).\r\u003cbr\u003e\r\u003cbr\u003eWorse still, Moo U only has classrooms for an odd number N (1 \u0026lt;\u003d N \u0026lt;\u003d 19,999) of the C (N \u0026lt;\u003d C \u0026lt;\u003d 100,000) calves who have applied.Bessie wants to admit exactly N calves in order to maximize educational opportunity. She still wants the median CSAT score of the admitted calves to be as high as possible.\r\u003cbr\u003e\r\u003cbr\u003eRecall that the median of a set of integers whose size is odd is the middle value when they are sorted. For example, the median of the set {3, 8, 9, 7, 5} is 7, as there are exactly two values above 7 and exactly two values below it.\r\u003cbr\u003e\r\u003cbr\u003eGiven the score and required financial aid for each calf that applies, the total number of calves to accept, and the total amount of money Bessie has for financial aid, determine the maximum median score Bessie can obtain by carefully admitting an optimal set of calves.\r\u003cbr\u003e\r\u003cbr\u003e"}},{"title":"Input","value":{"format":"HTML","content":"* Line 1: Three space-separated integers N, C, and F\r\u003cbr\u003e\r\u003cbr\u003e* Lines 2..C+1: Two space-separated integers per line. The first is the calf\u0027s CSAT score; the second integer is the required amount of financial aid the calf needs\r\u003cbr\u003e"}},{"title":"Output","value":{"format":"HTML","content":"* Line 1: A single integer, the maximum median score that Bessie can achieve. If there is insufficient money to admit N calves,output -1.\r\u003cbr\u003e"}},{"title":"Sample","value":{"format":"HTML","content":"\u003ctable class\u003d\u0027vjudge_sample\u0027\u003e\n\u003cthead\u003e\n \u003ctr\u003e\n \u003cth\u003eInput\u003c/th\u003e\n \u003cth\u003eOutput\u003c/th\u003e\n \u003c/tr\u003e\n\u003c/thead\u003e\n\u003ctbody\u003e\n \u003ctr\u003e\n \u003ctd\u003e\u003cpre\u003e3 5 70\r\n30 25\r\n50 21\r\n20 20\r\n5 18\r\n35 30\r\n\u003c/pre\u003e\u003c/td\u003e\n \u003ctd\u003e\u003cpre\u003e35\r\n\u003c/pre\u003e\u003c/td\u003e\n \u003c/tr\u003e\n\u003c/tbody\u003e\n\u003c/table\u003e\n"}},{"title":"Hint","value":{"format":"HTML","content":"\u003cb\u003eSample output:\u003c/b\u003eIf Bessie accepts the calves with CSAT scores of 5, 35, and 50, the median is 35. The total financial aid required is 18 + 30 + 21 \u003d 69 \u0026lt;\u003d 70.\r\u003cbr\u003e"}}]}