#C11868. Employee Seating Arrangement

    ID: 41231 Type: Default 1000ms 256MiB

Employee Seating Arrangement

Employee Seating Arrangement

Given a grid with r rows and c columns, determine the maximum number of employees that can be seated such that no two employees are adjacent. Two employees are considered adjacent if they share a side or a diagonal.

This problem is equivalent to finding the maximum independent set in a grid graph. The answer can be computed based on the parity of the grid dimensions:

  • If either r = 1 or c = 1, then the answer is \(\left\lfloor\frac{r \times c + 1}{2}\right\rfloor\).
  • If either r or c is even, then the answer is \(\frac{r \times c}{2}\).
  • If both r and c are odd, then the answer is \(\frac{r \times c}{2} + 1\).

Your task is to write a program that reads two integers from the standard input (representing r and c) and prints the maximum number of employees that can be seated according to the above rules.

inputFormat

The input consists of a single line containing two space-separated integers r and c, where r is the number of rows and c is the number of columns of the grid.

outputFormat

Output a single integer which is the maximum number of employees that can be seated such that no two employees are adjacent.

## sample
1 1
1