题目
![在这里插入图片描述](https://i-blog.csdnimg.cn/blog_migrate/1afff96546b67cb9c3cfdfa48763e015.png)
代码
自己写的,100分
#include <iostream>
#include <algorithm>
using namespace std;
const int maxn = 1e3 + 10;
struct point {
int x, y;
}p[maxn][maxn];
int main() {
int n, k, t, xl, yd, xr, yu;
int ans1 = 0, ans2 = 0;
cin >> n >> k >> t >> xl >> yd >> xr >> yu;
for (int i = 0; i < n; i++) {
for (int j = 0; j < t; j++) {
cin >> p[i][j].x >> p[i][j].y;
}
}
for (int i = 0; i < n; i++) {
for (int j = 0; j < t; j++) {
if (p[i][j].x >= xl && p[i][j].x <= xr && p[i][j].y >= yd && p[i][j].y <= yu) {
ans1++;
break;
}
}
}
for (int i = 0; i < n; i++) {
int count = 0, count_max = 0;
for (int j = 0; j < t; j++) {
if (p[i][j].x >= xl && p[i][j].x <= xr && p[i][j].y >= yd && p[i][j].y <= yu) {
count++;
count_max = max(count_max, count);
}
else count = 0;
}
if (count_max >= k) ans2++;
}
cout << ans1 << endl;
cout << ans2 << endl;
return 0;
}