Problem M
Virtual Reality Playspace
Yolanda just finished moving the furniture around her house. Her house is shaped like a rectangle of side lengths $r$ and $c$. Yolanda wants to choose a place to put her virtual reality (VR) playspace.
Yolanda has some standards for how a VR playspace should be positioned:
-
It should take the shape of a rectangle.
-
Its sides should be parallel and perpendicular to the sides of her house.
-
It must exactly cover the entirety of any unit square it occupies.
-
It should contain no obstacles.
-
It should be at least $s$ units across along one side, and at least $t$ units across along the other.
-
Each of its sides must border either the house’s outer walls, or obstacles. In other words, a VR playspace is maximally-sized.
Given a map of Yolanda’s house, Yolanda wants to know how many different places she can choose for her VR playspace.
Input
The first line of input contains four integers $r$, $c$, $s$, and $t$ ($1 \le r, c, s, t \le 3\, 000$), giving the length and width of Yolanda’s house and the size of her VR playspace.
The next $r$ lines each contain a string of $c$ characters describing Yolanda’s house. Each character is either a dot (.) that denotes an empty square unit of space, or a zero (0) that denotes a square unit of obstacle.
Output
Output a single integer, the number of different places Yolanda can choose for her VR playspace.
Sample Input 1 | Sample Output 1 |
---|---|
4 7 1 2 .....00 .0...0. ..00.0. .0.0.00 |
6 |