暴力/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++. ...
随机推荐
- Download Software Top 10
We are quite rich in terms of web browsers! Nevertheless, it's a bit surprising to know that even so ...
- MapReduce输入输出类型、格式及实例
输入格式 1.输入分片与记录 2.文件输入 3.文本输入 4.二进制输入 5.多文件输入 6.数据库格式输入 1.输入分片与记录 1.JobClient通过指定的输入文件的格式来生成数据分片Input ...
- Exception from container-launch: org.apache.hadoop.util.Shell$ExitCodeException
使用MapReduce编写的中文分词程序出现了 Exception from container-launch: org.apache.hadoop.util.Shell$ExitCodeExcept ...
- 鸟哥的Linux私房菜-----12、学习使用Shell scripts
- Eclipse导入项目: No projects are found to import
Eclipse导入项目: No projects are found to import 如果发导入工程import的时候,出现”No projects are found to import” 的 ...
- udhcp详解源码(序)
最近负责接入模块,包括dhcp.ipoe和pppoe等等.所以需要对dhcp和ppp这几个app的源代码进行一些分析.网上有比较好的文章,参考并补充自己的分析. 这篇udhcp详解是基于busybox ...
- 使用HD/IDE层的ioctl接口获取磁盘容量get_hdd_max_sector
利用HD/IDE layer的ioctl函数接口获取HD/IDE的磁盘容量.HDIO_DRIVE_TASK 能发出訪问LBA地址的命令.但不能读写数据. #include <stdio.h&g ...
- 【iOS系列】-文件管理
OC中操作文件,需要使用NSFileManager: 需要使用NSFileManager的创建方式: //单例模式创建对象 NSFileManager * f2 = [NSFileManager de ...
- 判断一个包是否可以安装是一个NP-complete问题
1 checking whether a single package P can be installed, given a repository R,is NP-complete
- What's the difference between HEAD, working tree and index, in Git?
What's the difference between HEAD, working tree and index, in Git?