1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 | #include <iostream> #include <algorithm> #include <map> #include <cstdio> #include <cstdlib> using namespace std; int n,k,t,xl,yd,xr,yu; int x[1005], y[1005]; bool visited,stayed; inline bool checkCoord(int posx,int posy){ return xl<=posx&&posx<=xr&&yd<=posy&&posy<=yu; } void checkPerson(){ visited = stayed = false; int cnt=0; for(int i=0;i<t;i++){ bool flag=checkCoord(x[i],y[i]); if(!flag)cnt=0; else cnt++; if(cnt>0)visited=true; if(cnt>=k){ stayed=true; break; } } } int main() { ios::sync_with_stdio(false); cin>>n>>k>>t>>xl>>yd>>xr>>yu; int vis=0,stay=0; for(int i=0;i<n;i++){ for(int j=0;j<t;j++){ cin>>x[j]>>y[j]; } checkPerson(); vis+=visited; stay+=stayed; } cout<<vis<<"\n"<<stay<<"\n"; } |
CSP 202009-2 风险人群筛查
发表评论