#include <bits/stdc++.h>
using namespace std;
int N,M;
int x,y,x2,y2;
pair<pair<int,int>,pair<int,int>>h[100],h1[100];
int toTop(int i){
h[N] = h[i];
for (int j = i; j < N; ++j) {
h[j] = h[j+1];
}
}
int pageNum(int i){
for (int j = 0; j < N; ++j) {
if(h[i] == h1[j])
return j + 1;
}
}
int find(int x,int y){
int index;
for (int i = N - 1; i >= 0 ; --i) {
if(x >= h[i].first.first && x <= h[i].second.first && y >= h[i].first.second && y <= h[i].second.second){
int index = pageNum(i);
toTop(i);
return index;
}
}
return 0;
}
int main() {
cin>>N>>M;
for (int i = 0; i < N; ++i) {
cin>>x>>y>>x2>>y2;
h[i].first.first = x;
h[i].first.second = y;
h[i].second.first = x2;
h[i].second.second = y2;
h1[i].first.first = x;
h1[i].first.second = y;
h1[i].second.first = x2;
h1[i].second.second = y2;
}
while (M--){
cin>>x>>y;
int res = find(x,y);
if(res > 0){
cout<<res<<endl;
}else{
cout<<"IGNORED"<<endl;
}
}
return 0;
}
csp窗口
最新推荐文章于 2023-12-02 16:25:38 发布