社区讨论

65pts求调必关码风良好思路清晰

P4147玉蟾宫参与者 1已保存回复 0

讨论操作

快速查看讨论及其快照的属性,并进行相关操作。

当前回复
0 条
当前快照
1 份
快照标识符
@mj8mq4al
此快照首次捕获于
2025/12/16 21:39
3 个月前
此快照最后确认于
2025/12/19 22:10
3 个月前
查看原帖
CPP
#include<bits/stdc++.h>
using namespace std;
const int N=1005;
char c[N][N];
int a[N][N],s[N];
int main(){
	int n,m,top=0,ans=0;
	cin>>n>>m;
	for(int i=1;i<=n;i++){
		top=0;
		for(int j=1;j<=m;j++){
			cin>>c[i][j];
			if(c[i][j]=='F'){
				a[i][j]=a[i-1][j]+1;
			}
			else a[i][j]=0;
			while(top&&a[i][j]<=a[i][s[top]]) top--;
			ans=max(ans,a[i][j]*(j-s[top]));
			s[++top]=j;
		}
	}
	cout<<3*ans;
	return 0;
}

回复

0 条回复,欢迎继续交流。

正在加载回复...