版本比较
最大子矩形
正文
增加 5 行删除 5 行
168 行未改动全部展开1691701711721731741751761776 行未改动18418518618718818919019119214 行未改动20720820921021121221321421521621721816 行未改动23523623723823924024124224312 行未改动168 行未改动全部展开```cpp//luogu P4147#include <cstdio>#include <iostream>#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 行未改动elsecnt = j;}}for (int j = 1; j <= m; ++ j)l[0][j] = 1, w[0][j] = m;//由于我太懒了,把h[i][j]的预处理都放在这个循环里了,应该不影响观感吧,要是影响的话各位读者把更新h[i][j]的部分手动挪出去就好啦QwQfor (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];//printf ("%d %d %d\n", i, j, s);}}}12 行未改动168 行未改动全部展开1691701711721731741751761776 行未改动18418518618718818919019119214 行未改动20720820921021121221321421521621721816 行未改动23523623723823924024124224312 行未改动168 行未改动全部展开```cpp//luogu P4147#include <cstdio>#include <iostream>#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 行未改动elsecnt = j;}}for (int j = 1; j <= m; ++ j)l[0][j] = 1, w[0][j] = m;//由于我太懒了,把h[i][j]的预处理都放在这个循环里了,应该不影响观感吧,要是影响的话各位读者把更新h[i][j]的部分手动挪出去就好啦QwQfor (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];//printf ("%d %d %d\n", i, j, s);}}}12 行未改动