
我的代码
#include<bits/stdc++.h>
using namespace std;
struct node
{
int ans;
bool f;
};
node a[130][130];
int main(void)
{
int d;
int n;
int x, y, k;
cin >> d >> n;
for(int i = 0;i < n;i++)
{
cin >> x >> y;
a[x][y].f = 1;
cin >> k;
for(int j = x - d;j <= x + d;j++)
{
for(int l = y - d;l <= y + d;l++)
{
a[j][l].ans += k;
}
}
}
int max1 = 0, max2 = 0;
for(int i = 1;i <= 128;i++)
{
for(int j = 1;j <= 128;j++)
{
cout << a[i][j].ans << ' ';
if(a[i][j].ans > max1)
{
max1 = a[i][j].ans;
if(a[i][j].f)
{
max2++;
}
}
else
{
max2 = 0;
}
}
}
cout << max2 << ' ' << max1 << endl;
return 0;
}
覆盖的公共场所最多输出有问题