为何厌氧?
// Handle: ScottSuperb
// Time: 2023-06-29 18:10:39
// Problem: 城市游戏
// Contest: AcWing
// URL: https://www.acwing.com/problem/content/description/154/
// Memory Limit: 64 MB
// Time Limit: 1000 ms
#include <bits/stdc++.h>
using namespace std;
#define MAXN 1005
int a[MAXN][MAXN], h[MAXN], w[MAXN], s[MAXN], t, ans;
int main() {
int n, m;
char ch;
scanf("%d%d", &n, &m);
for (int i = 0; i < n; ++i)
for (int j = 0; j < m; ++j) cin >> ch, a[i][j] = ch == 'F';
for (int i = 0; i < n; ++i)
for (int j = 0; j <= m; ++j) {
if (a[i][j])
++h[j];
else
h[j] = 0;
if (h[j] >= s[t])
s[++t] = h[j], w[t] = 1;
else {
int width = 0;
while (h[j] < s[t]) {
width += w[t];
ans = max(ans, width * s[t--]);
}
s[++t] = h[j], w[t] = width + 1;
}
}
printf("%d\n", ans * 3);
return 0;
}