CF475C.Kamal-ol-molk's Painting

普及/提高-

通过率:0%

AC君温馨提醒

该题目为【codeforces】题库的题目,您提交的代码将被提交至codeforces进行远程评测,并由ACGO抓取测评结果后进行展示。由于远程测评的测评机由其他平台提供,我们无法保证该服务的稳定性,若提交后无反应,请等待一段时间后再进行重试。

题目描述

The first line of input contains two integers nn and mm , ( 1<=n,m<=10001<=n,m<=1000 ), denoting the height and width of the painting.

The next nn lines contain the painting. Each line has mm characters. Character 'X' denotes an altered cell, otherwise it's showed by '.'. There will be at least one altered cell in the painting.

输入格式

Print the minimum area of the brush in a line, if the painting is possibly altered, otherwise print 1-1 .

输出格式

输入输出样例

  • 输入#1

    4 4
    XX..
    XX..
    XXXX
    XXXX
    

    输出#1

    4
    
  • 输入#2

    4 4
    ....
    .XXX
    .XXX
    ....
    

    输出#2

    2
    
  • 输入#3

    4 5
    XXXX.
    XXXX.
    .XX..
    .XX..
    

    输出#3

    -1
    
首页