标签:clu 优先级 names bre str amp main out poi
//100分
#include<iostream>
using namespace std;
typedef struct Point{
int x1,x2,y1,y2;
int order;
int no;
};
typedef struct XY{
int x,y;
};
int main(){
int n,m,i,j,count = 0,ok = 0;
cin>>n>>m;
XY xy[m];
Point point[n];
for(i=0;i<n;i++){
cin>>point[i].x1>>point[i].y1>>point[i].x2>>point[i].y2;
point[i].order = i+1;
point[i].no = i+1;
}
for(int k=0;k<m;k++) cin>>xy[k].x>>xy[k].y;
for(int k=0;k<m;k++){
ok = 0;
count = 0;
for(i=n;i>=1;i--){//优先级最高是n,按优先级进行查找
for(j=0;j<n;j++){
if(point[j].order==i){//找到优先级为i的窗口,判断m点是是在这个窗口里面
//存在
if(xy[k].x<=point[j].x2&&xy[k].x>=point[j].x1&&xy[k].y<=point[j].y2&&xy[k].y>=point[j].y1){
cout<<point[j].no;
if(point[j].order != n) {
for(int l=0;l<n;l++){
if(point[l].order>point[j].order) point[l].order--;
}
point[j].order = n;
}
ok = 1;
break;
}
//不存在
else {
count++;
ok = 0;
break;
}
}
}
//在优先级为最低的之前找到了所需要的窗口,
//则跳出优先级循环,寻找下一个m点
if(ok == 1) {
break;
}
}
if(count == n) {
cout<<"IGNORED";
}
if(k<m-1) cout<<endl;
}
return 0;
}
标签:clu 优先级 names bre str amp main out poi
原文地址:http://www.cnblogs.com/whitehouse2016/p/6568112.html