#include<iostream>
#include<map>
using namespace std;
struct note{
int ax1;
int ay1;
int ax2;
int ay2;
bool operator < (const note &a)const
{
return ax1 < a.ax1;
}
};
int main(){
int n,m;
cin>>n>>m;
note a[n];
map<note,int> p;
int j=1;
for(int i=n-1;i>=0;i--)
{
cin>>a[i].ax1>>a[i].ay1>>a[i].ax2>>a[i].ay2;
p[a[i]]=j++;
}
int flag=0;
while(m--){
int x,y;
cin>>x>>y;
for(int i=0;i<n;i++){
if(x>=a[i].ax1&&x<=a[i].ax2&&y>=a[i].ay1&&y<=a[i].ay2)
{
flag=1;
cout<<p[a[i]]<<endl;
note n1=a[i];
for(int j=i;j>0;j--)
a[j]=a[j-1];
a[0]=n1;
break;
}
}
if(flag==0)
cout<<"IGNORED"<<endl;
flag=0;
}
return 0;
}
这里map用了结构体作为键,此时应添加一个对<的重载
struct note{
int ax1;
int ay1;
int ax2;
int ay2;
bool operator < (const note &a)const
{
return ax1 < a.ax1;
}
};
就不会报错了