{"trustable":false,"sections":[{"title":"","value":{"format":"HTML","content":"\n \u003cdiv class\u003d\"ptx\"\u003e\n FJ有 N (1 \u0026lt;\u003d N \u0026lt;\u003d 50,000) 头挑剔的奶牛!她们非常挑剔,每头牛只会在一段确定的时间间隔 A..B (1 \u0026lt;\u003d A \u0026lt;\u003d B \u0026lt;\u003d 1,000,000) 内挤奶,包括 A 和 B 时刻。 很明显,FJ必须创建一个预约系统,以确定每头奶牛可以分配在哪个挤奶时间挤奶。当然,没有奶牛会愿意与其他奶牛分享这样的私人时刻。\n \u003cbr\u003e \n \u003cbr\u003e帮助 FJ 求出以下内容:\n \u003cul\u003e\n \u003cli\u003e需要挤奶棚的最小数量,以便每头奶牛都可以享受自己的挤奶时间\u003c/li\u003e\n \u003cli\u003e随着时间的推移将奶牛分配在这些挤奶棚中\u003c/li\u003e\n \u003c/ul\u003e每个数据可能会有多种答案,每个测试数据集中的答案都是正确的(即使用Special judge)。\n \u003c/div\u003e"}},{"title":"Input","value":{"format":"HTML","content":"\n \u003cdiv class\u003d\"ptx\" lang\u003d\"en-US\"\u003e\n Line 1: A single integer, N \n \u003cbr\u003e \n \u003cbr\u003eLines 2..N+1: Line i+1 describes cow i\u0027s milking interval with two space-separated integers.\n \u003c/div\u003e"}},{"title":"Output","value":{"format":"HTML","content":"\n \u003cdiv class\u003d\"ptx\" lang\u003d\"en-US\"\u003e\n Line 1: The minimum number of stalls the barn must have. \n \u003cbr\u003e \n \u003cbr\u003eLines 2..N+1: Line i+1 describes the stall to which cow i will be assigned for her milking period.\n \u003c/div\u003e"}},{"title":"Sample Input","value":{"format":"HTML","content":"\u003cpre class\u003d\"sio\"\u003e5\n1 10\n2 4\n3 6\n5 8\n4 7\u003c/pre\u003e"}},{"title":"Sample Output","value":{"format":"HTML","content":"\u003cpre class\u003d\"sio\"\u003e4\n1\n2\n3\n2\n4\u003c/pre\u003e"}},{"title":"Hint","value":{"format":"HTML","content":"\n \u003cdiv class\u003d\"ptx\" lang\u003d\"en-US\"\u003e\n Explanation of the sample: \n \u003cbr\u003e \n \u003cbr\u003eHere\u0027s a graphical schedule for this output: \n \u003cbr\u003e \n \u003cbr\u003e\n \u003cpre\u003eTime 1 2 3 4 5 6 7 8 9 10\n\u003cbr\u003eStall 1 c1\u0026gt;\u0026gt;\u0026gt;\u0026gt;\u0026gt;\u0026gt;\u0026gt;\u0026gt;\u0026gt;\u0026gt;\u0026gt;\u0026gt;\u0026gt;\u0026gt;\u0026gt;\u0026gt;\u0026gt;\u0026gt;\u0026gt;\u0026gt;\u0026gt;\u0026gt;\u0026gt;\u0026gt;\u0026gt;\u0026gt;\u0026gt;\n\u003cbr\u003eStall 2 .. c2\u0026gt;\u0026gt;\u0026gt;\u0026gt;\u0026gt;\u0026gt; c4\u0026gt;\u0026gt;\u0026gt;\u0026gt;\u0026gt;\u0026gt;\u0026gt;\u0026gt;\u0026gt; .. ..\n\u003cbr\u003eStall 3 .. .. c3\u0026gt;\u0026gt;\u0026gt;\u0026gt;\u0026gt;\u0026gt;\u0026gt;\u0026gt;\u0026gt; .. .. .. ..\n\u003cbr\u003eStall 4 .. .. .. c5\u0026gt;\u0026gt;\u0026gt;\u0026gt;\u0026gt;\u0026gt;\u0026gt;\u0026gt;\u0026gt; .. .. ..\u003c/pre\u003eOther outputs using the same number of stalls are possible.\n \u003c/div\u003e"}}]}