P3086 [USACO13OPEN] Figure Eight G

题目描述

Farmer John's cows recently received a large piece of marble, which, unfortunately, has a number of imperfections. To describe these, we can represent the piece of marble by an N by N square grid (5

输入格式

\* Line 1: A single integer N, indicating the side length of the marble. \* Lines 2..N+1: Each line describes a row of the marble, and contains N characters which are each either '\*' (an imperfection) or '.' (a flawless section). 第1行:一个整数n,表示大理石的边长。 行2 N + 1:每行描述了一排大理石,并包含n个字符,每个都是“\*”(缺陷)或'.' (完整)。

输出格式

\* Line 1: The highest aesthetic score of any figure eight which doesn't use any imperfect squares of the marble. If no figure eight is attainable, then output -1.

说明/提示

顶部的矩形面积6X9 = 54,和底部矩形面积12x6 = 72。因此,它的审美评分54x72 = 3888。 给出一个n×n的区域,其中有一些位置有瑕疵。现在要在没有瑕疵的位置中雕一个8”出来。 “8”字的定义为两个矩形框,框内面积均大于0,且一个矩形框的底边是是另一个矩形框的顶边的子集。 最大化两矩形框内面积的积。 感谢 @3505515693qq 提供翻译