You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
37 lines
944 B
37 lines
944 B
#include <bits/stdc++.h>
|
|
using namespace std;
|
|
typedef pair<int, int> PII;
|
|
#define x first
|
|
#define y second
|
|
|
|
PII a[110];
|
|
int n, L;
|
|
|
|
vector<int> X, Y;
|
|
|
|
int ans;
|
|
int main() {
|
|
cin >> n >> L;
|
|
for (int i = 1; i <= n; ++i) {
|
|
cin >> a[i].x >> a[i].y;
|
|
X.push_back(a[i].x);
|
|
X.push_back(a[i].x - L); // 所有可能的左上角起点坐标(x,y) 必然满足x in X,y in Y
|
|
Y.push_back(a[i].y);
|
|
Y.push_back(a[i].y - L);
|
|
}
|
|
|
|
for (int i = 0; i < X.size(); i++)
|
|
for (int j = 0; j < Y.size(); j++) { // 枚举每个可能的左上角坐标
|
|
int cnt = 0;
|
|
int x = X[i], y = Y[j];
|
|
for (int k = 1; k <= n; k++) // 枚举每个金矿
|
|
if (a[k].x >= x && a[k].x <= x + L && a[k].y >= y && a[k].y <= y + L)
|
|
cnt++;
|
|
|
|
ans = max(ans, cnt);
|
|
}
|
|
|
|
cout << ans << endl;
|
|
|
|
return 0;
|
|
} |