20分求助!!!WA提示信息看不懂
查看原帖
20分求助!!!WA提示信息看不懂
1029978
zyh1145楼主2023/11/16 22:06

第一个点:Wrong Answer.wrong answer Integer 508 violates the range [337, 337]

第二个点:Wrong Answer.wrong answer Integer 504 violates the range [339, 339]

最后一个:Wrong Answer.wrong answer Integer 247307 violates the range [197694, 197694]

我meì见过啊?代码:

#include <bits/stdc++.h>
using namespace std;
#define maxn 1005
#define LL long long
int a[maxn][maxn];
struct node
{
	int anx,any;
};
queue <node> s;
int main()
{
	ios::sync_with_stdio(false);
	cin.tie(0);
	cout.tie(0);
	int n,m,t,x,y,x2,y2,ans;
	cin>>n>>m;
	for (int i = 1;i <= n;i++)
	{
		for (int j = 1;j <= m;j++)
		{
			cin>>a[i][j];
		}
	}
	cin>>t;
	while (t--)
	{
		cin>>x>>y>>x2>>y2;
		swap(a[x][y],a[x2][y2]);
	}
	for (int i = 1;i <= n;i++)
	{
		for (int j = 1;j <= m;j++)
		{
			if (a[i][j] > a[i-1][j] && a[i][j] > a[i+1][j] && a[i][j] > a[i][j-1] && a[i][j] > a[i][j-1])
			{
				ans++;
				s.push((node){i,j});
			}
		}
	}
	cout<<ans<<endl;
	while (!s.empty())
	{
		cout<<s.front().anx<<" "<<s.front().any<<endl;
		s.pop();
	}
    return 0;
}
2023/11/16 22:06
加载中...