版本比较
最大子矩形
正文
增加 5 行删除 5 行
168 行未改动全部展开1691701711721731731741751761776 行未改动18418518618718818818919019119214 行未改动20720820921021121121221321421421521621721816 行未改动23523623723823923924024124224312 行未改动168 行未改动全部展开```cpp//luogu P4147#include <cstdio>#include <iostream>#include <algorithm> #include <algorithm>using namespace std;
const int MAXN = 1005;char mize[MAXN][MAXN];6 行未改动 scanf ("%d%d", &n, &m); for (int i = 1; i <= n; ++ i) for (int j = 1; j <= m; ++ j) cin >> mize[i][j];
for (int i = 1; i <= n; ++ i) { int cnt = 0;//cnt代表当前障碍点的位置,下一个是障碍点就更新,否则更新lef[i][j] for (int j = 1; j <= m; ++ j)14 行未改动 else cnt = j; } }
for (int j = 1; j <= m; ++ j) l[0][j] = 1, w[0][j] = m;
//由于我太懒了,把h[i][j]的预处理都放在这个循环里了,应该不影响观感吧,要是影响的话各位读者把更新h[i][j]的部分手动挪出去就好啦QwQ for (int i = 1; i <= n; ++ i) { for (int j = 1; j <= m; ++ j)16 行未改动 } } if ((w[i][j] - l[i][j] + 1) * h[i][j] > s) { s = (w[i][j] - l[i][j] + 1) * h[i][j]; s = (w[i][j] - l[i][j] + 1) * h[i][j]; //printf ("%d %d %d\n", i, j, s); } } }12 行未改动