AcWing 3293. 风险人群筛查
原题链接
简单
作者:
Value
,
2021-04-08 20:35:27
,
所有人可见
,
阅读 380
#include <iostream>
#include <cstdio>
#define x first
#define y second
using namespace std;
typedef pair<int, int> pii;
const int N = 1010;
pii a, b;
int n, k, t;
pii path[N];
int check(){
bool flag = false;
int cnt = 0;
int maxv = 0;
for(int i = 0; i < t; i ++ ){
if(path[i].x >= a.x && path[i].x <= b.x && path[i].y >= a.y && path[i].y <= b.y){
cnt ++ ;
flag = true;
}
else cnt = 0;
maxv = max(maxv, cnt);
}
if(!flag) return 0;
if(maxv >= k) return 2;
return 1;
}
int main(){
cin >> n >> k >> t >> a.x >> a.y >> b.x >> b.y;
int res1 = 0, res2 = 0;
while(n -- ){
for(int i = 0; i < t; i ++ ) scanf("%d%d", &path[i].x, &path[i].y);
int t = check();
if(t == 0) continue;
res1 ++ ;
if(t == 2) res2 ++ ;
}
cout << res1 << endl << res2 << endl;
return 0;
}