{"problem":{"name":"B. Segments","description":{"content":"You are given an integer _N_. Consider all possible segments on the coordinate axis with endpoints at integer points with coordinates between 0 and _N_, inclusive; there will be of them. You want to ","description_type":"Markdown"},"platform":"Codeforces","limit":{"time_limit":2000,"memory_limit":262144},"difficulty":"None","is_remote":true,"is_sync":true,"sync_url":null,"sign":"CF909B"},"statements":[{"statement_type":"Markdown","content":"You are given an integer _N_. Consider all possible segments on the coordinate axis with endpoints at integer points with coordinates between 0 and _N_, inclusive; there will be of them.\n\nYou want to draw these segments in several layers so that in each layer the segments don't overlap (they might touch at the endpoints though). You **can not** move the segments to a different location on the coordinate axis.\n\nFind the minimal number of layers you have to use for the given _N_.\n\n## Input\n\nThe only input line contains a single integer _N_ (1 ≤ _N_ ≤ 100).\n\n## Output\n\nOutput a single integer - the minimal number of layers required to draw the segments for the given _N_.\n\n[samples]\n\n## Note\n\nAs an example, here are the segments and their optimal arrangement into layers for _N_ = 4.\n\n<center>![image](https://espresso.codeforces.com/8a475108c50ca3e7a56a047302228224fc3fa969.png)</center>","is_translate":false,"language":"English"},{"statement_type":"Markdown","content":"[{\"iden\":\"statement\",\"content\":\"给定一个整数 $N$。考虑所有在坐标轴上端点为整数点、且坐标介于 0 和 $N$ 之间（含端点）的线段；共有 $\\\\frac{(N+1)(N+2)}{2}$ 条这样的线段。\\n\\n你希望将这些线段绘制在若干层中，使得每层中的线段互不重叠（但端点可以接触）。你*不能*将线段移动到坐标轴上的其他位置。\\n\\n求出绘制这些线段所需的最少层数。\\n\\n输入仅一行，包含一个整数 $N$（$1 ≤ N ≤ 100$）。\\n\\n输出一个整数——为给定 $N$ 绘制所有线段所需的最少层数。\\n\\n例如，下图展示了当 $N = 4$ 时的线段及其在各层中的最优排列方式。\\n\\n\"},{\"iden\":\"input\",\"content\":\"输入仅一行，包含一个整数 $N$（$1 ≤ N ≤ 100$）。\"},{\"iden\":\"output\",\"content\":\"输出一个整数——为给定 $N$ 绘制所有线段所需的最少层数。\"},{\"iden\":\"examples\",\"content\":\"输入2输出2输入3输出4输入4输出6\"},{\"iden\":\"note\",\"content\":\"例如，下图展示了当 $N = 4$ 时的线段及其在各层中的最优排列方式。 \"}]}","is_translate":true,"language":"Chinese"},{"statement_type":"Markdown","content":"**Definitions**  \nLet $ N \\in \\mathbb{Z} $, with $ 1 \\leq N \\leq 100 $.  \nLet $ \\mathcal{S} = \\{ [i, j] \\mid 0 \\leq i \\leq j \\leq N \\} $ be the set of all integer-coordinate segments on $[0, N]$.\n\n**Constraints**  \n- $ |\\mathcal{S}| = \\binom{N+1}{2} + (N+1) = \\frac{(N+1)(N+2)}{2} $\n\n**Objective**  \nFind the minimum number of layers $ L $ such that $ \\mathcal{S} $ can be partitioned into $ L $ subsets, where in each subset, no two segments overlap (i.e., for any two segments $[a,b], [c,d]$ in the same subset, either $ b \\leq c $ or $ d \\leq a $).\n\n**Known Result**  \nThe minimal number of layers equals the maximum number of segments that share a common interior point.  \nThis maximum is achieved at the midpoint, and equals $ \\left\\lfloor \\frac{N}{2} \\right\\rfloor + 1 $.  \n\nThus:  \n$$\nL = \\left\\lfloor \\frac{N}{2} \\right\\rfloor + 1\n$$","is_translate":false,"language":"Formal"}],"meta":{"iden":"CF909B","tags":["constructive algorithms","math"],"sample_group":[["2","2"],["3","4"],["4","6"]],"created_at":"2026-03-03 11:00:39"}}