#include<iostream> #include<queue> #include<algorithm> using namespace std; int n,m; struct node{ int x1; int x2; int y1; int y2; int num; int no; }win[12]; bool cmp(node a,node b){ return a.no>b.no;//按优先级高到低排序 } int main(){ cin>>n>>m; for(int i=1;i<=n;i++){ cin>>win[i].x1>>win[i].y1>>win[i].x2>>win[i].y2; win[i].num = i; win[i].no = i; } int x,y; for(int i=0;i<m;i++){ cin>>x>>y; int f=0; int temp = 0; sort(win+1,win+n+1,cmp); for(int j=1;j<=n;j++){ if(x>=win[j].x1&&x<=win[j].x2&&y>=win[j].y1&&y<=win[j].y2){ cout<<win[j].num<<endl; f=1; temp = win[j].no; break; } } if(f==0) cout<<"IGNORED"<<endl; else if(temp!=n){//表示该窗口不是顶层窗口时,更新窗口层数 for(int j=1;j<=n;j++){ if(win[j].no>temp){ win[j].no -= 1; }else if(win[j].no == temp){ win[j].no = n; } } } } return 0; }
标签:201403,node,窗口,no,int,win,y1,include From: https://www.cnblogs.com/deathgun/p/16777649.html