Cubes
A three-dimensional figure is made up of unit cubes. From this figure, you can create its front and right projections. However, it's not always possible to fully reconstruct the figure from just these two projections.
Write a program called CUBES that, given the front and right projections of the figure, calculates the minimum and maximum number of cubes that could form the figure based on these projections.
Input
The first line of the input contains three integers N
, M
, and K
, which represent the dimensions of the projections (1 ≤ N
, M
, K ≤ 100
). Following this, two projections are provided: first the front projection, then the right projection. Each projection consists of N
rows, with each row containing M
numbers for the front projection and K
numbers for the right projection. These numbers are either 0 or 1, where 0 represents an empty cell and 1 represents a filled cell.
Output
The output should be a single line containing two integers: the minimum and maximum number of cubes that could be used to construct the figure based on the given projections.