301372: CF257B. Playing Cubes

Memory Limit:256 MB Time Limit:2 S
Judge Style:Text Compare Creator:
Submit:0 Solved:0

Description

Playing Cubes

题意翻译

## 题目描述 有 $n$ 个红方块和 $m$ 个蓝方块 $(n,m \le 10^5)$,现在 Petya 先 Vasya 后二人轮流搭方块,如果上下两个方块颜色相同,则 Petya 得一分,否则 Vasya 得一分。问 Petya , Vasya 的最大可能得分分别是多少。 来自 @cff_0102 的题目翻译

题目描述

Petya and Vasya decided to play a little. They found $ n $ red cubes and $ m $ blue cubes. The game goes like that: the players take turns to choose a cube of some color (red or blue) and put it in a line from left to right (overall the line will have $ n+m $ cubes). Petya moves first. Petya's task is to get as many pairs of neighbouring cubes of the same color as possible. Vasya's task is to get as many pairs of neighbouring cubes of different colors as possible. The number of Petya's points in the game is the number of pairs of neighboring cubes of the same color in the line, the number of Vasya's points in the game is the number of neighbouring cubes of the different color in the line. Your task is to calculate the score at the end of the game (Petya's and Vasya's points, correspondingly), if both boys are playing optimally well. To "play optimally well" first of all means to maximize the number of one's points, and second — to minimize the number of the opponent's points.

输入输出格式

输入格式


The only line contains two space-separated integers $ n $ and $ m $ $ (1<=n,m<=10^{5}) $ — the number of red and blue cubes, correspondingly.

输出格式


On a single line print two space-separated integers — the number of Petya's and Vasya's points correspondingly provided that both players play optimally well.

输入输出样例

输入样例 #1

3 1

输出样例 #1

2 1

输入样例 #2

2 4

输出样例 #2

3 2

说明

In the first test sample the optimal strategy for Petya is to put the blue cube in the line. After that there will be only red cubes left, so by the end of the game the line of cubes from left to right will look as \[blue, red, red, red\]. So, Petya gets 2 points and Vasya gets 1 point. If Petya would choose the red cube during his first move, then, provided that both boys play optimally well, Petya would get 1 point and Vasya would get 2 points.

Input

题意翻译

## 题目描述 有 $n$ 个红方块和 $m$ 个蓝方块 $(n,m \le 10^5)$,现在 Petya 先 Vasya 后二人轮流搭方块,如果上下两个方块颜色相同,则 Petya 得一分,否则 Vasya 得一分。问 Petya , Vasya 的最大可能得分分别是多少。 来自 @cff_0102 的题目翻译

加入题单

上一题 下一题 算法标签: