P3135 [USACO16JAN]堡哞Fort Moo

    • 138通过
    • 309提交
  • 题目提供者 FarmerJohn2
  • 评测方式 云端评测
  • 标签 动态规划,动规,dp 构造 枚举,暴力 USACO 2016
  • 难度 提高+/省选-
  • 时空限制 1000ms / 128MB

题解

  • 提示:收藏到任务计划后,可在首页查看。
  • 最新讨论 显示

    推荐的相关题目 显示

    题目描述

    Bessie is building a fort with her friend Elsie. Like any good fort, this one needs to start with a sturdy frame. Bessie wants to build a frame in the shape of a one-meter-wide rectangular outline, atop which she will build the fort.

    Bessie has already chosen a site on which to build the fort -- a piece of land measuring $N$ meters by $M$ meters ($1 \leq N, M \leq 200$). Unfortunately, the site has some swampy areas that cannot be used to support the frame. Please help Bessie determine the largest area she can cover with her fort (the area of

    the rectangle supported by the frame), such that the frame avoids sitting on any of the swampy areas.

    Bessie和她的朋友Elsie正在建筑一个堡垒,与任何一个好的堡垒一样,这个需要一个强固的框架。Bessie想造一个轮廓是1m宽的空心矩形框架,这样堡垒就可以造在框架上了。

    Bessie以及选了一个地点建筑堡垒,一片N*M(1<=N,M<=200)的平地。不幸的是,这个地方有一些沼泽地而不可以支撑框架。请帮助Bessie决定最大她可以用堡垒覆盖的区域(即支撑框架的区域),而且避免框架在任何一块沼泽地上。

    输入输出格式

    输入格式:

    Line 1 contains integers $N$ and $M$.

    The next $N$ lines each contain $M$ characters, forming a grid describing the

    site. A character of '.' represents normal grass, while 'X' represents a swampy

    spot.

    输出格式:

    A single integer representing the maximum area that Bessie can cover with her

    fort.

    输入输出样例

    输入样例#1: 复制
    5 6
    ......
    ..X..X
    X..X..
    ......
    ..X...
    输出样例#1: 复制
    16

    说明

    In the example, the placement of the optimal frame is indicated by 'f's below:

    .ffff.
    .fX.fX
    Xf.Xf.
    .ffff.
    ..X...
    提示
    标程仅供做题后或实在无思路时参考。
    请自觉、自律地使用该功能并请对自己的学习负责。
    如果发现恶意抄袭标程,将按照I类违反进行处理。