暴力/DP Codeforces Beta Round #22 (Div. 2 Only) B. Bargaining Table
/*
题意:求最大矩形(全0)的面积
暴力/dp:每对一个0查看它左下的最大矩形面积,更新ans
注意:是字符串,没用空格,好事多磨,WA了多少次才发现:(
详细解释:http://www.cnblogs.com/cszlg/p/3217478.html
*/
#include <cstdio>
#include <algorithm>
#include <cstring>
#include <cmath>
using namespace std; const int MAXN = ;
const int INF = 0x3f3f3f3f;
char s[MAXN][MAXN];
int n, m; int get_sum(int x, int y)
{
int res = ; int d, w = ;
for (int i=x; i<n; ++i)
{
if (s[i][y] == '') break;
int j = y + ;
while (j < m && s[i][j] == '') ++j;
d = i - x + ;
if (w > j - y) w = j - y;
res = max (res, (w + d) * );
} return res;
} int main(void) //Codeforces Beta Round #22 (Div. 2 Only) B. Bargaining Table
{
while (scanf ("%d%d", &n, &m) == )
{
for (int i=; i<n; ++i)
{
scanf ("%s", s[i]);
} int ans = ;
for (int i=; i<n; ++i)
{
for (int j=; j<m; ++j)
{
if (s[i][j] == '')
{
ans = max (ans, get_sum (i, j));
}
}
} printf ("%d\n", ans);
} return ;
}
暴力/DP Codeforces Beta Round #22 (Div. 2 Only) B. Bargaining Table的更多相关文章
- Codeforces Beta Round #22 (Div. 2 Only)
Codeforces Beta Round #22 (Div. 2 Only) http://codeforces.com/contest/22 A 水题 #include<bits/stdc+ ...
- Codeforces Beta Round #22 (Div. 2 Only) E. Scheme dfs贪心
E. Scheme To learn as soon as possible the latest news about their favourite fundamentally new ope ...
- 图论/暴力 Codeforces Beta Round #94 (Div. 2 Only) B. Students and Shoelaces
题目传送门 /* 图论/暴力:这是个连通的问题,每一次把所有度数为1的砍掉,把连接的点再砍掉,总之很神奇,不懂:) */ #include <cstdio> #include <cs ...
- Codeforces Beta Round #83 (Div. 1 Only)题解【ABCD】
Codeforces Beta Round #83 (Div. 1 Only) A. Dorm Water Supply 题意 给你一个n点m边的图,保证每个点的入度和出度最多为1 如果这个点入度为0 ...
- Codeforces Beta Round #59 (Div. 2)
Codeforces Beta Round #59 (Div. 2) http://codeforces.com/contest/63 A #include<bits/stdc++.h> ...
- Codeforces Beta Round #31 (Div. 2, Codeforces format)
Codeforces Beta Round #31 (Div. 2, Codeforces format) http://codeforces.com/contest/31 A #include< ...
- Codeforces Beta Round #18 (Div. 2 Only)
Codeforces Beta Round #18 (Div. 2 Only) http://codeforces.com/contest/18 A 暴力 #include<bits/stdc+ ...
- Codeforces Beta Round #80 (Div. 2 Only)【ABCD】
Codeforces Beta Round #80 (Div. 2 Only) A Blackjack1 题意 一共52张扑克,A代表1或者11,2-10表示自己的数字,其他都表示10 现在你已经有一 ...
- Codeforces Beta Round #79 (Div. 2 Only)
Codeforces Beta Round #79 (Div. 2 Only) http://codeforces.com/contest/102 A #include<bits/stdc++. ...
随机推荐
- IOS开发 序列化与反序列化
原帖地址:http://blog.csdn.net/ally_ideveloper/article/details/7956942 不会用,记下自己有时间看 序列化与反序列化概述 序列化,它又称串行化 ...
- VM Workstation的Unity Mode有什么用
正常情况下,如果我启动了一个VM Workstaion的虚拟机,比如是一个Linux系统,并且没运行任何软件,进入Unity mode之后,我真实系统的左下角会有一个虚拟机的图标 点击这个图标可以打开 ...
- Visual Studio VS如何重置所有设置
工具-导入和导出设置-重置所有设置,点击下一步即可.
- 【Mongodb教程 第十课 】MongoDB 备份
MongoDB 数据转储 创建备份MongoDB中的数据库,应该使用mongodump命令.此命令将服务器的所有数据转储到转储目录.有许多可供选择,通过它可以限制的数据量或创建备份您的远程服务器. 语 ...
- Swift基础一(代码)
import Foundation println("Hello, World!") var string1 = "Hello BeiJing" //定义一个变 ...
- [Spring实战系列](19)Servlet不同版本号之间的差别
1. 2.3版本号 2.3版本号 <!DOCTYPE web-app PUBLIC "-//Sun Microsystems, Inc.//DTD Web Application ...
- HTML5裁剪图片并上传至服务器实现原理讲解
HTML5裁剪图片并上传至服务器实现原理讲解 经常做项目需要本地上传图片裁剪并上传服务器,比如会议头像等功能,但以前实现这类需求都很复杂,往往需要先把图片上传到服务器,然后返回给用户,让用户确定裁 ...
- 必备java参考资源列表
现在开始正式介绍这些参考资源. Web 站点和开发人员 Web 门户 网络无疑改变了共享资源和出版的本质(对我也是一样:您正在网络上阅读这篇文章),因此,从每位 Java 开发人员都应该关注的关键 W ...
- 什么是 jQuery EasyUI
jQuery EasyUI 是一个基于 jQuery 的框架,集成了各种用户界面插件. jQuery EasyUI 框架提供了创建网页所需的一切,帮助您轻松建立站点. easyui 是一个基于 jQu ...
- bacth参数说明 cmd parameter
http://www.robvanderwoude.com/parameters.php Windows NT 4 introduced a set of new features for comma ...