社区讨论

玄学CE

P7306 [COCI 2018/2019 #1] Strah参与者 2已保存回复 2

讨论操作

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

当前回复
2 条
当前快照
1 份
快照标识符
@m6vld0tg
此快照首次捕获于
2025/02/08 10:43
去年
此快照最后确认于
2025/11/04 09:46
4 个月前
查看原帖
CE信息为
Nothing is compiled: OUTPUT exceeds.
CPP
#include <bits/stdc++.h>
using namespace std;
#define int long long
int n,m,ans;
int a[2005][2005]={-1};
int st[2005],tot;
char x;
signed main()
{
	scanf("%lld%lld",&n,&m);
	for(int i=1;i<=n;++i)
		for(int j=1;j<=m;a[i][j]=x=='#'?0:a[i][j-1]+1,++j) cin>>x;
	for(int j=1;j<=m;++j,tot=0)
		for(int i=1;i<=n;++i)
		{
			while(tot&&a[i][j]<=a[st[tot]][j]) tot--;
			st[++tot]=i;
			for(int k=tot;k;--k) ans+=(a[st[k]][j]+1)*a[st[k]][j]*((i-st[k-1]+1)*(i-st[k-1])-(i-st[k]+1)*(i-st[k]))>>2;
		}
	printf("%lld",ans);
	return 0;
}

回复

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

正在加载回复...