## DMOPC '22 Contest 3 P1 - Holiday Colouring

View as PDF

Points: 5 (partial)
Time limit: 2.0s
Memory limit: 256M

Author:
Problem type

To celebrate New Year's, Red and Green are playing a traditional holiday colouring game on an by grid of gray squares. Red uses a red crayon, and Green uses a green crayon. Both players take turns colouring gray squares, with Red going first. For each player on their first turn, they can colour any gray square. On every turn after their first, they must colour a gray square which is horizontally or vertically touching another square of the colour they use, or pass the turn if they are unable to move. The game ends when both players are unable to move. The score of the player is the number of squares they have coloured. Assuming both players play optimally to maximize their scores, find the scores of both players.

#### Input Specification

The first and only line contains space-separated integers and .

#### Output Specification

Output two space-separated integers and , which represent the scores of Red and Green respectively when they play optimally to maximize their scores.

#### Sample Input

3 2

#### Sample Output

3 3