#P2591. [ZJOI2009] 函数

    ID: 1604 远端评测题 1000ms 125MiB 尝试: 0 已通过: 0 难度: 7 上传者: 标签>2009各省省选浙江状态压缩,状压最小割容斥

[ZJOI2009] 函数

Description

There are NN continuous functions fi(x)f_i(x), where 1iN1 \le i \le N. If for any unequal i,ji, j with 1i,jN1 \le i, j \le N, there exists exactly one xx such that fi(x)=fj(x)f_i(x) = f_j(x), and there exist infinitely many xx such that fi(x)<fj(x)f_i(x) < f_j(x), and for any i,j,ki, j, k with 1i<j<kN1 \le i < j < k \le N, there does not exist xx such that fi(x)=fj(x)=fk(x)f_i(x) = f_j(x) = f_k(x), then these NN continuous functions are said to satisfy the condition.

As shown in the left figure, there are 33 functions that satisfy the condition; on the far left, from bottom to top, they are f1,f2,f3f_1, f_2, f_3. In the right figure, the red part is the lowest layer of the entire graph, which we call the first layer. Similarly, the green part is the second layer, and the blue part is the third layer. Note that, in the right figure, the left segment of the first layer belongs to f1f_1, the middle segment belongs to f2f_2, and the last segment belongs to f3f_3. For the second layer, the left segment belongs to f2f_2, the next segment belongs to f1f_1, the next segment belongs to f3f_3, and the last segment belongs to f2f_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 NN functions that satisfy the conditions above, find the minimum possible number of segments that the KK-th layer can consist of.

Input Format

One line containing two integers NN, KK.

Output Format

One line containing a single integer: the minimum number of segments of the KK-th layer among the NN functions.

1 1

1

Hint

For 100%100\% of the testdata, 1KN1001 \le K \le N \le 100.

Translated by ChatGPT 5