记录编号 359323 评测结果 AAAAAAAAAA
题目名称 [Nescafé 20] 玉蟾宫 最终得分 100
用户昵称 Gravatarsxysxy 是否通过 通过
代码语言 C++ 运行时间 0.107 s
提交时间 2016-12-22 08:08:40 内存使用 15.83 MiB
显示代码纯文本
#include <cstdio>
#include <cstring>
#include <cstdarg>
#include <list>
#include <queue>
#include <vector>
#include <cctype>
using namespace std;
namespace IO
{
char buf[1<<18], *fs, *ft;
inline char readc()
{
    return (fs==ft&&(ft=(fs=buf)+fread(buf,1,1<<18,stdin),fs==ft))?0:*fs++;
}
inline int fast_read()
{
    int r;
    char c;
    bool s = false;
    while(c = readc())
    {
        if(c >= '0' && c <= '9')
        {
            r = c^0x30;
            break;
        }else if(c == '-')s = true;
    }
    while(isdigit(c = readc()))
        r = (r<<3)+(r<<1)+(c^0x30);
    return s?-r:r;
}
}using IO::fast_read;using IO::readc;
#define MAXN 1001
int field[MAXN][MAXN], len[MAXN][MAXN], left[MAXN][MAXN], right[MAXN][MAXN];
void work()
{
    int m, n; m = fast_read(); n = fast_read();
    for(int i = 0; i < m; i++)for(int j = 0; j < n; j++)
    {
        char c = readc();
        while(c != 'F' && c != 'R')c = readc();
        field[i][j] = c == 'F'? 0:1;
    }
    int ans = 0;
    for(int i = 0; i < m; i++)
    {
        int lo = -1, ro = n;
        for(int j = 0; j < n; j++) //calc lo
        {
            if(field[i][j])len[i][j] = left[i][j] = 0, lo = j;
            else
            {
                len[i][j] = i?(len[i-1][j]+1):1;
                left[i][j] = i?max(lo+1, left[i-1][j]):lo+1;
            }
        }
        for(int j = n-1; ~j; j--)
        {
            if(field[i][j])right[i][j] = n, ro = j;
            else
            {
                right[i][j] = i?min(right[i-1][j], ro-1):ro-1;
                ans = max(ans, len[i][j]*(right[i][j]-left[i][j]+1));
            }
        }
    }
    printf("%d\n", ans*3);
}

int main()
{
    freopen("jademoon.in", "r", stdin);
    freopen("jademoon.out", "w", stdout);
    //int T;scanf("%d", &T);
    //while(T--)
        work();
    
    return 0;
}