P29999 [洛谷] "PHOI-1" Rain Drizzles
普及
题目描述

Problem Description

In an open field of \( n \) rows and \( m \) columns, there is an umbrella of size \( x \) rows and \( y \) columns, which cannot be rotated. Each day, \( 1 \sim k \) drops of rain are randomly sprinkled onto the field. A grid that already has rain will not receive more rain, and a grid under the umbrella will not get wet.

This umbrella is special; it is completely transparent, and Xiao X cannot directly determine its location. However, after each day, Xiao X will be informed of the status of each empty grid on the field, whether it has received rain or not. Note that Xiao X only knows the status of the grids and cannot know where the rain fell each day.

Now, Xiao X wants you to determine the best-case scenario (i.e., the minimum number of days) required to uniquely identify the location of the umbrella, as well as the minimum number of rain drops needed on the field after the umbrella's position is known. The data guarantees a solution.

Formally, there is a \( n \times m \) rectangle, and you can at most remove \( k \) grids each day. You need to find out the minimum number of days and the minimum number of grids to be removed to make the complete \( x \times y \) rectangle unique in the diagram.

Input Format

A line containing five integers: \( n, m, x, y, k \).

Output Format

A line containing two integers: the minimum number of days in the best-case scenario to identify the umbrella's position, and the minimum number of rain drops needed on the field after the umbrella's position is known, separated by a space.

Sample Input and Output

Sample Input #1

4 4 2 2 3

Sample Output #1

1 3

Sample Input #2

7 5 3 2 2

Sample Output #2

3 5

Sample Input #3

214 748 3 64 8

Sample Output #3

98 782

Notes/Hints

This problem uses batched testing.

Subtask \( n, m \) \( x, y \) Score
0 \( 1 \le n, m \le 10 \) No special restrictions 10
1 \( 1 \le n, m \le 10^3 \) No special restrictions 30
2 No special restrictions \( x = y = 2 \) 10
3 No special restrictions \( 1 \le x = y \le 10^9 \) 10
4 No special restrictions No special restrictions 40

For \( 100\% \) of the data, it is guaranteed that \( 1 \le x \le n \le 10^9, 1 \le y \le m \le 10^9, 1 \le k \le 10^9 \).

Sample Explanation #1:

On the first day, rain drops fall at positions \((2,2), (2,3), (3,2)\), which can determine that the top-left and bottom-right corners of the umbrella are at \((3,3), (4,4)\).

Sample Explanation #2:

On the first day, rain drops fall at positions \((2,2), (7,1)\); on the second day, at \((5,4)\); and on the third day, at \((4,2), (3,4)\). This can determine that the top-left and bottom-right corners of the umbrella are at \((5,2), (7,3)\).

输入格式

见题面 Input 部分

输出格式

见题面 Output 部分

样例输入
4 4 2 2 3
样例输出
1 3