CF1558A Charmed by the Game

题目描述

Alice 和 Borys 在打网球。 网球比赛有很多局,每局有一个人发球,有一个人接发球。这样轮流交换,一人一局。 每局比赛都有一个胜者,如果胜者是发球者,那么称为保发,反之称为破发。 我们知道 Alice 赢了 $a$ 局,Borys 赢了 $b$ 局,但我们不知道谁先发球和每局谁赢了。 问所有可能的总破发次数。

输入格式

第一行是数据组数 $t(1≤t≤10^3)$。 下面的 $t$ 行,每行有两个数 $a,b(0≤a,b≤10^5)$。 数据保证每组数据中 $a+b$ 的和相加小于 $2·10^5$。

输出格式

对于每组数据输出两行。 第一行输出一个整数 $m$,表示共有 $m$ 种破发可能。 第二行输出 $m$ 个整数 $k_1,k_2…k_m$,表示每种可能的破发总数,升序输出。

说明/提示

In the first test case, any number of breaks between $ 0 $ and $ 3 $ could happen during the match: - Alice holds serve, Borys holds serve, Alice holds serve: $ 0 $ breaks; - Borys holds serve, Alice holds serve, Alice breaks serve: $ 1 $ break; - Borys breaks serve, Alice breaks serve, Alice holds serve: $ 2 $ breaks; - Alice breaks serve, Borys breaks serve, Alice breaks serve: $ 3 $ breaks. In the second test case, the players could either both hold serves ( $ 0 $ breaks) or both break serves ( $ 2 $ breaks). In the third test case, either $ 2 $ or $ 3 $ breaks could happen: - Borys holds serve, Borys breaks serve, Borys holds serve, Borys breaks serve, Borys holds serve: $ 2 $ breaks; - Borys breaks serve, Borys holds serve, Borys breaks serve, Borys holds serve, Borys breaks serve: $ 3 $ breaks.