思路1 dp
dp的状态方程是最左边、最右边和高 从最左边、最右边和高来找面积
If you think this algorithm is not easy to understand, you can try this example:
0 0 0 1 0 0 0 0 0 1 1 1 0 0 0 1 1 1 1 1 0 The vector "left" and "right" from row 0 to row 2 are as follows
row 0:
l: 0 0 0 3 0 0 0 r: 7 7 7 4 7 7 7 row 1:
l: 0 0 2 3 2 0 0 r: 7 7 5 4 5 7 7 row 2:
l: 0 1 2 3 2 1 0 r: 7 6 5 4 5 6 7
Last updated