# Include <stdio. h> # include <algorithm> # include <string. h ># include <iostream> using namespace STD; char a [1010] [1010]; int dd [1010] [1010]; // width int R [1010], L [1010]; int main () {int T, I, j, n, m, max1; while (~ Scanf ("% d", & T) {While (t --) {scanf ("% d", & N, & M); getchar (); for (I = 1; I <= N; I ++) for (j = 1; j <= m; j ++) cin> A [I] [J]; for (I = 1; I <= m; I ++) dd [0] [I] = 0; /// initialize the imaginary row for (I = 1; I <= N; I ++) // obtain the height of each point {for (j = 1; j <= m; j ++) {if (a [I] [J] = 'F') dd [I] [J] = dd [I-1] [J] + 1; else dd [I] [J] = 0 ;}} max1 =-1; for (I = 1; I <= N; I ++) /// convert to hdu1506 {for (j = 1; j <= m; j ++) L [J] = R [J] = J; For (j = 2; j <= m; j ++) {While (Dd [I] [L [J]-1]> = dd [I] [L [J] & L [J]> 1) L [J] = L [L [J]-1];} For (j = s-1; j> = 1; j --) {While (Dd [I] [R [J] + 1]> = dd [I] [R [J] & R [J] <m) R [J] = R [R [J] + 1] ;}for (j = 1; j <= m; j ++) {max1 = max (max1, dd [I] [J] * (R [J]-l [J] + 1);} printf ("% d \ n ", max1 * 3) ;}} return 0 ;}
HDU 1505 City game (hdu1506 enhanced Edition)