请问佬们,激光炸弹这道题为什么会MLE呀
#include <iostream>
#include <cstring>
#include <cstdio>
#include <algorithm>
using namespace std;
const int N = 5010;
int n, r;
int x;
int y;
int s[N][N];
int b[N][N];
int t;
int main(){
cin >> n >> r;
for(int i = 1; i <= n; i++)
{
scanf("%d %d", &x, &y);
scanf("%d", &s[x][y]);
}
//前缀和的预处理
for(int i = 1; i <= n; i++){
for(int j = 1; j <= n; j++)
s[i][j] = s[i - 1][j] + s[i][j - 1] + s[i][j] - s[i - 1][j - 1];
}
for(int i = r; i <= n; i++)
for(int j = r; j <= n; j++){
b[i][j] = s[i][j] - s[i - r][j] - s[i][j - r] + s[i - r][j - r];
if(b[i][j] > t) t = b[i][j];
}
cout << t << endl;
return 0;
}