Leon has created a cute little robot spider pet! //
Instead of generating an intricate pattern for its web, it simply interweaves
Please help implement some of its functions, and you might be rewarded (with points)!
F1: Robo-Spider generates silk somehow (don't ask me, I'm just the programmer).
It weaves in consecutive rows of silk, filling in all rows from
F2: Same as F1, but for columns.
F3: Consecutive rows of silk snap (blame the chemist)!
Only existing strands of silk that make up rows
F4: Same as F3, but for columns.
F5: How much of the web is exposed? Please determine the total area not covered by the web.
F6: How optimal is the web? Please determine the area of the hole with the maximum area in the web.
Input Specification
The first line contains three integers:
The following
Output Specification
For each F5 and F6, output the answer on its own line.
Constraints
Subtask | Percentage | Constraints |
---|---|---|
Sample Input
10 10 7
6
1 4 6
5
2 7 8
6
3 5 5
5
Sample Output
100
70
24
64
Diagram
A picture is worth a thousand words.
\ 1 2 3 4 5 6 7 8 9 10
1
2
3
4
5 100
6
7
8
9
10
\ 1 2 3 4 5 6 7 8 9 10
1
2 30
3
4 --------------------
5 -------------------- = 70
6 --------------------
7
8 40
9
10
\ 1 2 3 4 5 6 7 8 9 10
1 | |
2 | |
3 | |
4 ------------|-------
5 --------------|-----
6 ------------|-------
7 | |
8 24 | |
9 | |
10 | |
\ 1 2 3 4 5 6 7 8 9 10
1 | |
2 18 | | 6
3 | |
4 ------------|-------
5 6 | | 2 = 64
6 ------------|-------
7 | |
8 24 | | 8
9 | |
10 | |
Comments