308033: CF1455C. Ping-pong
Memory Limit:256 MB
Time Limit:1 S
Judge Style:Text Compare
Creator:
Submit:0
Solved:0
Description
Ping-pong
题意翻译
Alice 和 Bob 在玩乒乓球。 在一轮比赛中,发球的人开始比赛。发球员击球,接球员回球。此后,发球员和接球员必须交替击球,直到其中一方不击球。不击球的一方输掉这轮比赛,获胜方在下一轮比赛开始发球。由 Alice 开始第一轮比赛。 Alice 有 $x$ 点体力, Bob 有 $y$ 点体力,每次击球会消耗 1 点体力。如果体力不足则不能击球。每轮比赛开始的一方如果有体力必须发球。如果两人都没有体力则游戏结束。 Alice 和 Bob 都采取最优策略进行游戏。他们希望首先最大化自己获胜的场数,其次最小化对方获胜的场数。 计算 Alice 和 Bob 获胜的场数。题目描述
Alice and Bob play ping-pong with simplified rules. During the game, the player serving the ball commences a play. The server strikes the ball then the receiver makes a return by hitting the ball back. Thereafter, the server and receiver must alternately make a return until one of them doesn't make a return. The one who doesn't make a return loses this play. The winner of the play commences the next play. Alice starts the first play. Alice has $ x $ stamina and Bob has $ y $ . To hit the ball (while serving or returning) each player spends $ 1 $ stamina, so if they don't have any stamina, they can't return the ball (and lose the play) or can't serve the ball (in this case, the other player serves the ball instead). If both players run out of stamina, the game is over. Sometimes, it's strategically optimal not to return the ball, lose the current play, but save the stamina. On the contrary, when the server commences a play, they have to hit the ball, if they have some stamina left. Both Alice and Bob play optimally and want to, firstly, maximize their number of wins and, secondly, minimize the number of wins of their opponent. Calculate the resulting number of Alice's and Bob's wins.输入输出格式
输入格式
The first line contains a single integer $ t $ ( $ 1 \le t \le 10^4 $ ) — the number of test cases. The first and only line of each test case contains two integers $ x $ and $ y $ ( $ 1 \le x, y \le 10^6 $ ) — Alice's and Bob's initial stamina.
输出格式
For each test case, print two integers — the resulting number of Alice's and Bob's wins, if both of them play optimally.
输入输出样例
输入样例 #1
3
1 1
2 1
1 7
输出样例 #1
0 1
1 1
0 7