样例过了但是WA 求调
  • 板块P2004 领地选择
  • 楼主Const_AKer
  • 当前回复0
  • 已保存回复0
  • 发布时间2024/7/19 09:00
  • 上次更新2024/7/19 10:22:30
查看原帖
样例过了但是WA 求调
1038686
Const_AKer楼主2024/7/19 09:00
#include<bits/stdc++.h>
#pragma G++ optimize(2)
using namespace std;
long long n,m,c,i,j,a[1005][1005],temp,x,y,cnt,maxcnt=-20000000000000000;
int main()
{
	ios::sync_with_stdio(0);cin.tie(0);cout.tie(0);
	cin>>n>>m>>c;
	for(i=1;i<=n;i++)
	{
		for(j=1;j<=m;j++)
		{
			cin>>temp;
			a[i][j]=a[i][j-1]+a[i-1][j]-a[i-1][j-1]+temp;
		}
	}
	for(i=0;i+c<=n+1;i++)
	{
		for(j=0;j+c<=m+1;j++)
		{
			cnt=a[i+c][j+c]-a[i+c][j]-a[i][j+c]+a[i][j];
			if(cnt>maxcnt)
			{
				x=i;
				y=j;
				maxcnt=cnt;
			}
		}
	}
	cout<<x+1<<' '<<y+1;
	return 0;
}
2024/7/19 09:00
加载中...