#K3161. Tent Placement Optimization
Tent Placement Optimization
Tent Placement Optimization
You are given a grid with n rows and m columns. Your task is to determine the minimum number of tents required so that every cell in the grid has at least one tent in its neighboring cells. It has been observed that one tent can cover a block of 2×2 cells. Therefore, an optimal placement is to position the tents such that each covers a 2×2 subgrid.
The answer can be computed using the formula:
$\lceil \frac{n}{2} \rceil \times \lceil \frac{m}{2} \rceil$
For example, if the grid is 3×3, the minimal number of tents required is 4.
inputFormat
The input consists of a single line containing two space-separated integers n
and m
(1 ≤ n, m ≤ 1000) representing the number of rows and columns of the grid.
outputFormat
Output a single integer which is the minimal number of tents required.
## sample3 3
4