QOJ.ac

QOJ

実行時間制限: 1 s メモリ制限: 256 MB 満点: 100

#13287. Function

統計

There are $n$ continuous functions $f_i(x)$ for $1 \le i \le n$. For any two functions $f_i(x)$ and $f_j(x)$ ($i \neq j$), there exists exactly one $x$ such that $f_i(x) = f_j(x)$, and there exist infinitely many $x$ such that $f_i(x) < f_j(x)$. For any $i, j, k$ satisfying $1 \le i < j < k \le n$, there is no $x$ such that $f_i(x) = f_j(x) = f_k(x)$.

The figure on the left shows 3 functions satisfying these conditions, ordered from bottom to top on the far left as $f_1, f_2, f_3$. In the figure on the right, the red part is the lowest layer of the entire function graph, which we call the first layer. Similarly, the green part is called the second layer, and the blue part is called the third layer. Note that in the right figure, the first layer consists of a segment belonging to $f_1$, then a segment belonging to $f_2$, and finally a segment belonging to $f_3$. The second layer starts with a segment belonging to $f_2$, followed by a segment belonging to $f_1$, then a segment belonging to $f_3$, and finally a segment belonging to $f_2$. Therefore, we say the first layer is divided into three segments, and the second layer is divided into four segments. Similarly, the third layer is divided into only two segments. Given $n$ functions satisfying the conditions above, find the minimum number of segments the $k$-th layer can be composed of.

Input

A single line containing two integers $n, k$.

Output

A single integer representing the minimum number of segments the $k$-th layer can be composed of for $n$ functions.

Constraints

For 100% of the data, $1 \le k \le n \le 100$.

Examples

Input 1

1 1

Output 1

1

Discussions

About Discussions

The discussion section is only for posting: General Discussions (problem-solving strategies, alternative approaches), and Off-topic conversations.

This is NOT for reporting issues! If you want to report bugs or errors, please use the Issues section below.

Open Discussions 0
No discussions in this category.

Issues

About Issues

If you find any issues with the problem (statement, scoring, time/memory limits, test cases, etc.), you may submit an issue here. A problem moderator will review your issue.

Guidelines:

  1. This is not a place to publish discussions, editorials, or requests to debug your code. Issues are only visible to you and problem moderators.
  2. Do not submit duplicated issues.
  3. Issues must be filed in English or Chinese only.
Active Issues 0
No issues in this category.
Closed/Resolved Issues 0
No issues in this category.