{"trustable":true,"prependHtml":"\u003cscript\u003e window.katexOptions \u003d { disable: true }; \u003c/script\u003e\n\u003cscript type\u003d\"text/x-mathjax-config\"\u003e\n MathJax.Hub.Config({\n tex2jax: {\n inlineMath: [[\u0027$$$\u0027,\u0027$$$\u0027], [\u0027$\u0027,\u0027$\u0027]],\n displayMath: [[\u0027$$$$$$\u0027,\u0027$$$$$$\u0027], [\u0027$$\u0027,\u0027$$\u0027]]\n }\n });\n\u003c/script\u003e\n\u003cscript async src\u003d\"https://mathjax.codeforces.org/MathJax.js?config\u003dTeX-AMS-MML_HTMLorMML\" type\u003d\"text/javascript\"\u003e\u003c/script\u003e","sections":[{"title":"","value":{"format":"HTML","content":"\u003cdiv class\u003d\"panel_content\"\u003eYou are given n closed, integer intervals [ai, bi] and n integers c1, ..., cn.\u003cbr\u003e\u003cbr\u003eWrite a program that:\u003cbr\u003e\u003cbr\u003e\u0026gt; reads the number of intervals, their endpoints and integers c1, ..., cn from the standard input,\u003cbr\u003e\u003cbr\u003e\u0026gt; computes the minimal size of a set Z of integers which has at least ci common elements with interval [ai, bi], for each i \u003d 1, 2, ..., n,\u003cbr\u003e\u003cbr\u003e\u0026gt; writes the answer to the standard output\u003cbr\u003e\u003c/div\u003e"}},{"title":"Input","value":{"format":"HTML","content":"The first line of the input contains an integer n (1 \u0026lt;\u003d n \u0026lt;\u003d 50 000) - 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 50 000 and 1 \u0026lt;\u003d ci \u0026lt;\u003d bi - ai + 1.\u003cbr\u003e\u003cbr\u003eProcess to the end of file.\u003cbr\u003e\u003cbr\u003e"}},{"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 \u003d 1, 2, ..., n.\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\u003e5\r\n3 7 3\r\n8 10 3\r\n6 8 1\r\n1 3 1\r\n10 11 1\r\n\u003c/pre\u003e\u003c/td\u003e\n \u003ctd\u003e\u003cpre\u003e6\r\n\u003c/pre\u003e\u003c/td\u003e\n \u003c/tr\u003e\n\u003c/tbody\u003e\n\u003c/table\u003e\n"}}]}