/**
题目要求:求一个n*m矩阵内的最大子矩阵(矩阵元素全为F)
hdu1506加强版
关键的预处理:
构造一个n*m的矩阵h,h[i][j]代表的是以h[i][j]为底的字符'F'的最大高度。
遍历,对于每一行,就转化成了hdu1506的问题了
例如:
原来的矩阵 h矩阵
R F F F F F 0 1 1 1 1 1
F F F F F F 1 2 2 2 2 2
R R R F F F -----> 0 0 0 3 3 3
F F F F F F 1 1 1 4 4 4
F F F F F F 2 2 2 5 5 5
*/
#include <stdio.h>
#include <string.h>
#include <iostream>
using namespace std;
#define N 1001
int area[2][N];
int lef[N],rig[N];
char s[N];
int main()
{
int n,m,t,i,j;
scanf("%d",&t);
while(t--)
{
scanf("%d%d",&n,&m);
int cur,pre;
memset(area,0,sizeof(area));
int