202009-2 风险人群筛查
![题目](https://i-blog.csdnimg.cn/blog_migrate/4165c16696cfa06956bc0060d074ca11.png)
注意样例2是因为没有连续时刻经过所以不算逗留,刚开始也没有注意连续经过这个条件,还是得心细
#include<iostream>
#include<stack>
#include<algorithm>
#include<string>
#include<map>
using namespace std;
int main()
{
int n,k,t,xl,yd,xr,yu;
cin>>n>>k>>t>>xl>>yd>>xr>>yu;
int x,y;
int count;
int m=0,p=0;
int maxCount=0;
bool flag;
for(int i=0;i<n;i++){
count=0;
maxCount=0;
flag=false;
for(int j=0;j<t;j++){
cin>>x>>y;
if(x>=xl&&x<=xr&&y>=yd&&y<=yu&&(flag||count==0)){
count++;
flag=true;
}else{
flag=false;
count=0;
}
if(count>maxCount) maxCount=count;
}
if(maxCount!=0) m++;
if(maxCount>=k) p++;
}
cout<<m<<endl;
cout<<p;
return 0;
}