hdu1505 City Game
来源:互联网 发布:淘宝店现在还挣钱么 编辑:程序博客网 时间:2024/06/05 09:27
hdu1506 加强版
#include <fstream>#include <iostream>#include <string>#include <complex>#include <math.h>#include <set>#include <vector>#include <map>#include <queue>#include <stdio.h>#include <stack>#include <algorithm>#include <list>#include <ctime>#include <memory.h>#include <ctime>#include <assert.h>#define rep(i,a,n) for (int i=a;i<n;i++)#define per(i,a,n) for (int i=n-1;i>=a;i--)#define pb push_back#define mp make_pair#define all(x) (x).begin(),(x).end()#define fi first#define se second#define eps 1e-8#define M_PI 3.141592653589793typedef long long ll;const ll mod=1000000007;const int inf=99999999;ll powmod(ll a,ll b) {ll res=1;a%=mod;for(;b;b>>=1){if(b&1)res=res*a%mod;a=a*a%mod;}return res;}using namespace std;const int maxn=1100;int a[maxn],l[maxn],r[maxn];char M[maxn][maxn];int main(){ int T;scanf("%d",&T); while(T--){ int n,m;scanf("%d %d",&n,&m); getchar(); for(int i=1;i<=n;i++){ for(int j=1;j<=m;j++){ scanf("%c",&M[i][j]); getchar(); } } int res=0; memset(a,0,sizeof(a)); a[0]=a[m+1]=-1; for(int i=1;i<=n;i++){ for(int j=1;j<=m;j++){ if(M[i][j]=='F') a[j]+=1; else if(M[i][j]=='R') a[j]=0; } for(int j=1;j<=m;j++) l[j]=r[j]=j; for(int j=1;j<=m;j++){ while(a[l[j]-1]>=a[j]) l[j]=l[l[j-1]]; } for(int j=m;j>=1;j--){ while(a[r[j]+1]>=a[j]) r[j]=r[r[j+1]]; } for(int j=1;j<=m;j++) res=max(res,(r[j]-l[j]+1)*a[j]); } printf("%d\n",3*res); }}
0 0
- 【DP】 hdu1505 City Game
- HDU1505/POJ1964 City Game
- HDU1505--City Game
- hdu1505 City Game
- hdu1505 City Game
- hdu1505 City Game (单调栈)
- hdu1505 City Game--DP/栈
- hdu1505 City Game(DP)
- hdu1505 City Game (最大子矩形)
- hdu1505--City Game(扫描线+坑啊 )
- hdu1505---City Game(单调栈)
- hdu1505 City Game (最大子矩阵)
- hdu1505 City game(最大子矩阵)
- hdu1505 City Game二维01矩阵求最大矩形周长
- poj2559 Largest Rectangle in a Histogram hdu1505 City Game
- HDU1505--City Game(动态规划)(1506加强版)
- HDU1505——City Game(扫描线)
- HDU1505 City Game (DP,HDU1506加强版)
- 哈夫曼树的定义和基本概念(从百度百科copy)
- Android基础Fragment以及动画
- maven3实战之仓库(maven仓库分类)
- Java NIO 聊天室实例
- 实战c++中的string系列--函数返回局部变量string(引用局部string,局部string的.c_str()函数)
- hdu1505 City Game
- 哈夫曼树的java实现
- APUE 第八章《进程控制》学习笔记
- Go语言中Tcp协议粘包问题处理
- 代码格式化
- openstack python api 开发
- linux下android 常用指令
- linux terminal终端插件oh-my-zsh
- Implement strStr()