{"trustable":true,"sections":[{"title":"","value":{"format":"HTML","content":"You are given n closed, integer intervals [ai, bi] and n integers c1, ..., cn. \r\u003cbr\u003eWrite a program that: \r\u003cbr\u003ereads the number of intervals, their end points and integers c1, ..., cn from the standard input, \r\u003cbr\u003ecomputes the minimal size of a set Z of integers which has at least ci common elements with interval [ai, bi], for each i\u003d1,2,...,n, \r\u003cbr\u003ewrites the answer to the standard output. \r\u003cbr\u003e"}},{"title":"Input","value":{"format":"HTML","content":"The first line of the input contains an integer n (1 \u0026lt;\u003d n \u0026lt;\u003d 50000) -- the number of intervals. The following n lines describe the intervals. The (i+1)-th line of the input contains three integers ai, bi and ci separated by single spaces and such that 0 \u0026lt;\u003d ai \u0026lt;\u003d bi \u0026lt;\u003d 50000 and 1 \u0026lt;\u003d ci \u0026lt;\u003d bi - ai+1. "}},{"title":"Output","value":{"format":"HTML","content":"The output contains exactly one integer equal to the minimal size of set Z sharing at least ci elements with interval [ai, bi], for each i\u003d1,2,...,n. "}},{"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\u003e5\r\n3 7 3\r\n8 10 3\r\n6 8 1\r\n1 3 1\r\n10 11 1\u003c/pre\u003e\u003c/td\u003e\n \u003ctd\u003e\u003cpre\u003e6\u003c/pre\u003e\u003c/td\u003e\n \u003c/tr\u003e\n\u003c/tbody\u003e\n\u003c/table\u003e\n"}}]}