Codeforces Round 433 (Div. 2, based on Olympiad of Metropolises)
B
Maxim Buys an Apartment
Codeforces
1200
原题
← AC →
翻译中…

Maxim wants to buy an apartment in a new house at Line Avenue of Metropolis. The house has $*n*$ apartments that are numbered from $1$ to $*n*$ and are arranged in a row. Two apartments are adjacent if their indices differ by $1$. Some of the apartments can already be inhabited, others are available for sale.

翻译中…

Maxim often visits his neighbors, so apartment is good for him if it is available for sale and there is at least one already inhabited apartment adjacent to it. Maxim knows that there are exactly $*k*$ already inhabited apartments, but he doesn't know their indices yet.

翻译中…

Find out what could be the minimum possible and the maximum possible number of apartments that are good for Maxim.

翻译中…

Input

翻译中…

The only line of the input contains two integers: $*n*$ and $*k*$ ($1 ≤ *n* ≤ 10^{9}$, $0 ≤ *k* ≤ *n*$).

翻译中…

Output

翻译中…

Print the minimum possible and the maximum possible number of apartments good for Maxim.

翻译中…

Note

翻译中…

In the sample test, the number of good apartments could be minimum possible if, for example, apartments with indices $1$, $2$ and $3$ were inhabited. In this case only apartment $4$ is good. The maximum possible number could be, for example, if apartments with indices $1$, $3$ and $5$ were inhabited. In this case all other apartments: $2$, $4$ and $6$ are good.

翻译中…

样例

Input #1
6 3
Output #1
1 3
InputCopy OutputCopy
题目信息
题号
854B
时间限制
1 s
内存限制
512 MB
标签
构造
数学

题面与样例版权归 Codeforces 及出题人所有;中文翻译由 AI 生成(CI 管线),如有出入请以原文为准。