CCF 202009-2 风险人群筛查

#include
#define TLE ios::sync_with_stdio(0),cin.tie(0)
#define long long ll
const int INF = 0x3f3f3f3f;
const int maxn = 10005;
using namespace std;
struct Node{
     
	int x, y;
}node[maxn];
int main(){
     
	TLE;
	int n,k,t,xl,yd,xr,yu;
	cin>>n>>k>>t>>xl>>yd>>xr>>yu;
	int jg = 0,dl = 0;
	for(int i = 1;i<=n;i++){
     
		memset(node,0,sizeof(node));
		for(int j = 1;j<=t;j++){
     
			cin>>node[j].x>>node[j].y;
		}
		int temp = 0,flag_dl = 0,flag_jg =0;
		for(int j = 1;j<=t;j++){
     
			int x = node[j].x,y = node[j].y;
			if(x>=xl&&x<=xr&&y>=yd&&y<=yu) temp++;
			else{
     
				if(temp>=k&&!flag_dl) {
     
					dl++; //cout<<2<
					flag_dl = 1;
					if(!flag_jg){
     
						jg++; //cout<<1<
						flag_jg = 1;
					}
				}
				else if(temp<k&&temp>=1&&!flag_jg) {
     
					jg++; //cout<<1<
					flag_jg = 1;
				}
				temp = 0;
			}
		}
		if(temp>=k&&!flag_dl) {
     
			dl++; //cout<<2<
			flag_dl = 1;
			if(!flag_jg){
     
				jg++; //cout<<1<
				flag_jg = 1;
			}
		}
		else if(temp <k&&temp>=1&&!flag_jg) {
     
			jg++; //cout<<1<
			flag_jg = 1;
		}	
	}
	cout<<jg<<endl<<dl;
} 

你可能感兴趣的:(CCF,CSP)