Solutions are presented as using the least memory and the fastest execution time. It also takes the top
10 most recent solutions from each language. If you want to limit to a specific index, click the
"Solved" button and go to that problem.
Problems
B"Alice and Borys are playing tennis. A tennis match consists of games. In each game, one of the players is serving and the other one is receiving. Players serve in turns: after a game where Alice is serving follows a game where Borys is serving, and vice versa. Each game ends with a victory of one of the players. If a game is won by the serving player, it's said that this player holds serve. If a game is won by the receiving player, it's said that this player breaks serve. It is known that Alice won a games and Borys won b games during the match. It is unknown who served first and who won which games. Find all values of k such that exactly k breaks could happen during the match between Alice and Borys in total. Each test contains multiple test cases. The first line contains the number of test cases t ( 1 <= t <= 10^3 ). Description of the test cases follows. Each of the next t lines describes one test case and contains two integers a and b ( 0 <= a, b <= 10^5 ; a + b > 0 ) -- the number of games won by Alice and Borys, respectively. It is guaranteed that the sum of a + b over all test cases does not exceed 2 cdot 10^5 . For each test case print two lines. In the first line, print a single integer m ( 1 <= m <= a + b + 1 ) -- the number of values of k such that exactly k breaks could happen during the match. In the second line, print m distinct integers k_1, k_2, ldots, k_m ( 0 <= k_1 < k_2 < ldots < k_m <= a + b ) -- the sought values of k in increasing order. In the first test case, any number of breaks between 0 and 3 could happen during the match: 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: "... |
Tutorials
Submissions
Submission Id |
Author(s) |
Index |
Submitted |
Verdict |
Language |
Test Set |
Tests Passed |
Time taken (ms) |
Memory Consumed (bytes) |
Tags |
Rating |
126880274 |
Gassa |
A |
Aug. 24, 2021, 3:50 p.m. |
OK |
D |
TESTS |
20 |
46 |
9011200 |
|
1300 |
126982999 |
gxlois |
A |
Aug. 25, 2021, 3:32 p.m. |
OK |
D |
TESTS |
20 |
77 |
10854400 |
|
1300 |
126847417 |
hos.lyric |
A |
Aug. 24, 2021, 2:38 p.m. |
OK |
D |
TESTS |
20 |
124 |
10854400 |
|
1300 |
126853498 |
AlanWaP |
A |
Aug. 24, 2021, 2:49 p.m. |
OK |
GNU C++14 |
TESTS |
20 |
31 |
3686400 |
|
1300 |
126921689 |
zxjk |
A |
Aug. 25, 2021, 12:20 a.m. |
OK |
GNU C++14 |
TESTS |
20 |
31 |
3788800 |
|
1300 |
126936604 |
Dzhao |
A |
Aug. 25, 2021, 5:35 a.m. |
OK |
GNU C++14 |
TESTS |
20 |
31 |
3788800 |
|
1300 |
126847530 |
Isonan |
A |
Aug. 24, 2021, 2:39 p.m. |
OK |
GNU C++14 |
TESTS |
20 |
31 |
3891200 |
|
1300 |
126863621 |
vincent163 |
A |
Aug. 24, 2021, 3:11 p.m. |
OK |
GNU C++14 |
TESTS |
20 |
31 |
3891200 |
|
1300 |
126857855 |
Yahli |
A |
Aug. 24, 2021, 2:59 p.m. |
OK |
GNU C++14 |
TESTS |
20 |
31 |
3891200 |
|
1300 |
126851712 |
F1aMiR3 |
A |
Aug. 24, 2021, 2:47 p.m. |
OK |
GNU C++14 |
TESTS |
20 |
31 |
3891200 |
|
1300 |
126855153 |
TheBlackDog |
A |
Aug. 24, 2021, 2:53 p.m. |
OK |
GNU C++14 |
TESTS |
20 |
31 |
3993600 |
|
1300 |
127007233 |
studentGZW |
A |
Aug. 26, 2021, 12:37 a.m. |
OK |
GNU C++14 |
TESTS |
20 |
31 |
4505600 |
|
1300 |
126927025 |
nestling |
A |
Aug. 25, 2021, 2:47 a.m. |
OK |
GNU C++14 |
TESTS |
20 |
31 |
4505600 |
|
1300 |
126855620 |
DDOSvoid |
A |
Aug. 24, 2021, 2:54 p.m. |
OK |
GNU C++17 |
TESTS |
20 |
30 |
3993600 |
|
1300 |
126983778 |
Ritesh7.1 |
A |
Aug. 25, 2021, 3:41 p.m. |
OK |
GNU C++17 |
TESTS |
20 |
31 |
3686400 |
|
1300 |
126917947 |
stevancv |
A |
Aug. 24, 2021, 9:25 p.m. |
OK |
GNU C++17 |
TESTS |
20 |
31 |
3788800 |
|
1300 |
126849800 |
Hazyknight |
A |
Aug. 24, 2021, 2:44 p.m. |
OK |
GNU C++17 |
TESTS |
20 |
31 |
3788800 |
|
1300 |
126998805 |
lxyb |
A |
Aug. 25, 2021, 7:27 p.m. |
OK |
GNU C++17 |
TESTS |
20 |
31 |
3788800 |
|
1300 |
126948967 |
ctd6969 |
A |
Aug. 25, 2021, 8:10 a.m. |
OK |
GNU C++17 |
TESTS |
20 |
31 |
3788800 |
|
1300 |
126850598 |
tapir1729 |
A |
Aug. 24, 2021, 2:45 p.m. |
OK |
GNU C++17 |
TESTS |
20 |
31 |
3788800 |
|
1300 |
127000459 |
shaswt_20 |
A |
Aug. 25, 2021, 8:02 p.m. |
OK |
GNU C++17 |
TESTS |
20 |
31 |
3788800 |
|
1300 |
126857002 |
ikaurov |
A |
Aug. 24, 2021, 2:56 p.m. |
OK |
GNU C++17 |
TESTS |
20 |
31 |
3891200 |
|
1300 |
126870829 |
Melania |
A |
Aug. 24, 2021, 3:27 p.m. |
OK |
GNU C++17 |
TESTS |
20 |
31 |
3891200 |
|
1300 |
126855964 |
yosupo |
A |
Aug. 24, 2021, 2:54 p.m. |
OK |
GNU C++17 (64) |
TESTS |
20 |
30 |
7270400 |
|
1300 |
126852568 |
math957963 |
A |
Aug. 24, 2021, 2:48 p.m. |
OK |
GNU C++17 (64) |
TESTS |
20 |
31 |
4300800 |
|
1300 |
126851683 |
AQT |
A |
Aug. 24, 2021, 2:47 p.m. |
OK |
GNU C++17 (64) |
TESTS |
20 |
31 |
4300800 |
|
1300 |
126851742 |
antekb |
A |
Aug. 24, 2021, 2:47 p.m. |
OK |
GNU C++17 (64) |
TESTS |
20 |
31 |
4300800 |
|
1300 |
126852690 |
ast123 |
A |
Aug. 24, 2021, 2:48 p.m. |
OK |
GNU C++17 (64) |
TESTS |
20 |
31 |
4300800 |
|
1300 |
126852111 |
ooooxxxx |
A |
Aug. 24, 2021, 2:47 p.m. |
OK |
GNU C++17 (64) |
TESTS |
20 |
31 |
4300800 |
|
1300 |
126940075 |
rgnerdplayer |
A |
Aug. 25, 2021, 6:23 a.m. |
OK |
GNU C++17 (64) |
TESTS |
20 |
31 |
4300800 |
|
1300 |
126927785 |
_int32 |
A |
Aug. 25, 2021, 3:03 a.m. |
OK |
GNU C++17 (64) |
TESTS |
20 |
31 |
4300800 |
|
1300 |
126871779 |
pacha2880 |
A |
Aug. 24, 2021, 3:29 p.m. |
OK |
GNU C++17 (64) |
TESTS |
20 |
31 |
4300800 |
|
1300 |
126854381 |
KTR |
A |
Aug. 24, 2021, 2:51 p.m. |
OK |
GNU C++17 (64) |
TESTS |
20 |
31 |
4300800 |
|
1300 |
126848155 |
clyring |
A |
Aug. 24, 2021, 2:41 p.m. |
OK |
Haskell |
TESTS |
20 |
31 |
11673600 |
|
1300 |
126858802 |
codelegend |
A |
Aug. 24, 2021, 3:02 p.m. |
OK |
Haskell |
TESTS |
20 |
233 |
33689600 |
|
1300 |
126852091 |
Sohomot_Vai |
A |
Aug. 24, 2021, 2:47 p.m. |
OK |
Java 11 |
TESTS |
20 |
218 |
24371200 |
|
1300 |
126850941 |
dalt |
A |
Aug. 24, 2021, 2:45 p.m. |
OK |
Java 11 |
TESTS |
20 |
233 |
25600000 |
|
1300 |
126860130 |
insert_cool_handle |
A |
Aug. 24, 2021, 3:04 p.m. |
OK |
Java 11 |
TESTS |
20 |
234 |
24678400 |
|
1300 |
126861851 |
pulkit1411 |
A |
Aug. 24, 2021, 3:07 p.m. |
OK |
Java 11 |
TESTS |
20 |
265 |
44134400 |
|
1300 |
126936148 |
sourabh19278 |
A |
Aug. 25, 2021, 5:29 a.m. |
OK |
Java 11 |
TESTS |
20 |
296 |
24576000 |
|
1300 |
126918334 |
mphillotry |
A |
Aug. 24, 2021, 9:39 p.m. |
OK |
Java 11 |
TESTS |
20 |
327 |
31744000 |
|
1300 |
126986923 |
dhleeab |
A |
Aug. 25, 2021, 4:18 p.m. |
OK |
Java 11 |
TESTS |
20 |
358 |
40960000 |
|
1300 |
126935866 |
sourabh19278 |
A |
Aug. 25, 2021, 5:25 a.m. |
OK |
Java 11 |
TESTS |
20 |
873 |
24576000 |
|
1300 |
126919249 |
crazypursuer |
A |
Aug. 24, 2021, 10:12 p.m. |
OK |
Java 11 |
TESTS |
20 |
997 |
32051200 |
|
1300 |
126909962 |
2020akadaver |
A |
Aug. 24, 2021, 6:27 p.m. |
OK |
Java 8 |
TESTS |
20 |
124 |
21094400 |
|
1300 |
126937219 |
athu18 |
A |
Aug. 25, 2021, 5:44 a.m. |
OK |
Java 8 |
TESTS |
20 |
170 |
31436800 |
|
1300 |
126850361 |
YahiaSherif |
A |
Aug. 24, 2021, 2:45 p.m. |
OK |
Java 8 |
TESTS |
20 |
202 |
28057600 |
|
1300 |
126850704 |
fetetriste |
A |
Aug. 24, 2021, 2:45 p.m. |
OK |
Java 8 |
TESTS |
20 |
234 |
28057600 |
|
1300 |
126866642 |
medude |
A |
Aug. 24, 2021, 3:17 p.m. |
OK |
Java 8 |
TESTS |
20 |
296 |
27852800 |
|
1300 |
126981676 |
titan_is_back |
A |
Aug. 25, 2021, 3:16 p.m. |
OK |
Java 8 |
TESTS |
20 |
795 |
28057600 |
|
1300 |
126919224 |
FlameFire |
A |
Aug. 24, 2021, 10:10 p.m. |
OK |
Java 8 |
TESTS |
20 |
858 |
28876800 |
|
1300 |
126849457 |
SecondThread |
A |
Aug. 24, 2021, 2:43 p.m. |
OK |
Java 8 |
TESTS |
20 |
889 |
28057600 |
|
1300 |
126850459 |
arvindf232 |
A |
Aug. 24, 2021, 2:45 p.m. |
OK |
Kotlin |
TESTS |
20 |
140 |
21094400 |
|
1300 |
126858273 |
Hakiobo |
A |
Aug. 24, 2021, 3 p.m. |
OK |
Kotlin |
TESTS |
20 |
140 |
27033600 |
|
1300 |
126862118 |
LeoPro |
A |
Aug. 24, 2021, 3:08 p.m. |
OK |
Kotlin |
TESTS |
20 |
217 |
33280000 |
|
1300 |
126850431 |
darnley |
A |
Aug. 24, 2021, 2:45 p.m. |
OK |
Kotlin |
TESTS |
20 |
280 |
38707200 |
|
1300 |
127000208 |
d3l3t3_my_l1f3 |
A |
Aug. 25, 2021, 7:56 p.m. |
OK |
MS C++ 2017 |
TESTS |
20 |
140 |
3788800 |
|
1300 |
126851792 |
eSeF_ |
A |
Aug. 24, 2021, 2:47 p.m. |
OK |
.NET Core C# |
TESTS |
20 |
108 |
22835200 |
|
1300 |
126897547 |
mban259 |
A |
Aug. 24, 2021, 4:40 p.m. |
OK |
.NET Core C# |
TESTS |
20 |
109 |
23040000 |
|
1300 |
126848668 |
keymoon |
A |
Aug. 24, 2021, 2:42 p.m. |
OK |
.NET Core C# |
TESTS |
20 |
217 |
24883200 |
|
1300 |
126854573 |
azukun |
A |
Aug. 24, 2021, 2:52 p.m. |
OK |
.NET Core C# |
TESTS |
20 |
249 |
36249600 |
|
1300 |
126854293 |
Yupiteru |
A |
Aug. 24, 2021, 2:51 p.m. |
OK |
.NET Core C# |
TESTS |
20 |
311 |
40755200 |
|
1300 |
126907400 |
aeternalis1 |
A |
Aug. 24, 2021, 5:59 p.m. |
OK |
PyPy 2 |
TESTS |
20 |
171 |
40243200 |
|
1300 |
126856380 |
raj1307 |
A |
Aug. 24, 2021, 2:55 p.m. |
OK |
PyPy 2 |
TESTS |
20 |
217 |
27545600 |
|
1300 |
126910992 |
PiKa_PiKaa_chuuu |
A |
Aug. 24, 2021, 6:42 p.m. |
OK |
PyPy 3 |
TESTS |
20 |
155 |
35840000 |
|
1300 |
126850299 |
conqueror_of_tourist |
A |
Aug. 24, 2021, 2:44 p.m. |
OK |
PyPy 3 |
TESTS |
20 |
217 |
44236800 |
|
1300 |
126849817 |
Kiri8128 |
A |
Aug. 24, 2021, 2:44 p.m. |
OK |
PyPy 3 |
TESTS |
20 |
233 |
31129600 |
|
1300 |
126931547 |
FrozenKandy |
A |
Aug. 25, 2021, 4:13 a.m. |
OK |
PyPy 3 |
TESTS |
20 |
233 |
33792000 |
|
1300 |
126847931 |
asdsasd |
A |
Aug. 24, 2021, 2:40 p.m. |
OK |
PyPy 3 |
TESTS |
20 |
234 |
32153600 |
|
1300 |
126859907 |
misorin |
A |
Aug. 24, 2021, 3:04 p.m. |
OK |
PyPy 3 |
TESTS |
20 |
249 |
32256000 |
|
1300 |
126851620 |
titia |
A |
Aug. 24, 2021, 2:46 p.m. |
OK |
PyPy 3 |
TESTS |
20 |
249 |
33587200 |
|
1300 |
126854285 |
SPD_9X2 |
A |
Aug. 24, 2021, 2:51 p.m. |
OK |
PyPy 3 |
TESTS |
20 |
249 |
34099200 |
|
1300 |
126853581 |
eepsilon |
A |
Aug. 24, 2021, 2:50 p.m. |
OK |
PyPy 3 |
TESTS |
20 |
264 |
33996800 |
|
1300 |
126963801 |
simply_hooman |
A |
Aug. 25, 2021, 11:29 a.m. |
OK |
PyPy 3 |
TESTS |
20 |
295 |
30924800 |
|
1300 |
126856178 |
nwi |
A |
Aug. 24, 2021, 2:55 p.m. |
OK |
Python 2 |
TESTS |
20 |
155 |
19660800 |
|
1300 |
126924361 |
Quan2202 |
A |
Aug. 25, 2021, 1:47 a.m. |
OK |
Python 3 |
TESTS |
20 |
342 |
7065600 |
|
1300 |
126936201 |
UDIT_MITTAL |
A |
Aug. 25, 2021, 5:29 a.m. |
OK |
Python 3 |
TESTS |
20 |
374 |
12185600 |
|
1300 |
126850574 |
sansen |
A |
Aug. 24, 2021, 2:45 p.m. |
OK |
Rust |
TESTS |
20 |
31 |
11571200 |
|
1300 |
126858474 |
cottoncotton |
A |
Aug. 24, 2021, 3:01 p.m. |
OK |
Rust |
TESTS |
20 |
46 |
3891200 |
|
1300 |
126937814 |
noogler |
A |
Aug. 25, 2021, 5:52 a.m. |
OK |
Rust |
TESTS |
20 |
46 |
6758400 |
|
1300 |
126853419 |
apilat |
A |
Aug. 24, 2021, 2:49 p.m. |
OK |
Rust |
TESTS |
20 |
46 |
6963200 |
|
1300 |
remove filters
Back to search problems