{"trustable":true,"sections":[{"title":"","value":{"format":"HTML","content":"给定n个闭合的整数区间 [ai, bi] 和 n个整数 c1, ..., cn。\r\u003cbr\u003e编写一个程序:\r\u003cbr\u003e从标准输入中读取区间的数量,它们的端点和整数 c1, ..., cn,\r\u003cbr\u003e计算至少与区间 [ai, bi] 有ci个公共元素的整数集合Z的最小大小,对于每个i\u003d1,2,...,n,\r\u003cbr\u003e将答案写入标准输出。\r\u003cbr\u003e"}},{"title":"输入","value":{"format":"HTML","content":"输入的第一行包含一个整数n (1 \u003c\u003d n \u003c\u003d 50000) -- 区间的数量。接下来的n行描述了这些区间。输入的第(i+1)行包含三个整数ai, bi和ci,它们用单个空格分隔,满足0 \u003c\u003d ai \u003c\u003d bi \u003c\u003d 50000和1 \u003c\u003d ci \u003c\u003d bi - ai+1。"}},{"title":"输出","value":{"format":"HTML","content":"输出包含一个整数,它等于整数集合Z的最小大小,使得至少与区间 [ai, bi] 有ci个公共元素,对于每个i\u003d1,2,...,n。"}},{"title":"示例","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"}}]}