{"trustable":false,"sections":[{"title":"","value":{"format":"HTML","content":"\n \u003cdiv class\u003d\"ptx\" lang\u003d\"en-US\"\u003e\n An integer interval [a,b], a \u0026lt; b, is a set of all consecutive integers beginning with a and ending with b. \n \u003cbr\u003eWrite a program that: finds the minimal number of elements in a set containing at least two different integers from each interval.\n \u003c/div\u003e\n给出n个区间,现在要你找出一个点集,使得这n个区间都至少有2个元素在这个点集里面,问这个点集最少有几个点。"}},{"title":"Input","value":{"format":"HTML","content":"\n \u003cdiv class\u003d\"ptx\" lang\u003d\"en-US\"\u003e\n The first line of the input contains the number of intervals n, 1 \u0026lt;\u003d n \u0026lt;\u003d 10000. Each of the following n lines contains two integers a, b separated by a single space, 0 \u0026lt;\u003d a \u0026lt; b \u0026lt;\u003d 10000. They are the beginning and the end of an interval. \n \u003c/div\u003e\n\u003cbr\u003e第一行一个整数n。\n\u003cbr\u003e接下来n行,每行两个整数a,b,表示区间的左端点和右端点,被空格隔开。\n\u003cbr\u003e所有输入数据的范围[0,10000]"}},{"title":"Output","value":{"format":"HTML","content":"\n \u003cdiv class\u003d\"ptx\" lang\u003d\"en-US\"\u003e\n Output the minimal number of elements in a set containing at least two different integers from each interval. \n \u003c/div\u003e输出集合最小的大小,满足区间都至少有两个点在集合中。"}},{"title":"Sample Input","value":{"format":"HTML","content":"\u003cpre class\u003d\"sio\"\u003e4\n3 6\n2 4\n0 2\n4 7\n\u003c/pre\u003e"}},{"title":"Sample Output","value":{"format":"HTML","content":"\u003cpre class\u003d\"sio\"\u003e4\n\u003c/pre\u003e"}}]}