AcWing 3198. 窗口
原题链接
简单
作者:
Value
,
2021-03-19 08:34:01
,
所有人可见
,
阅读 409
#include <iostream>
#include <vector>
#define x first
#define y second
using namespace std;
typedef pair<int, int> pii;
const int N = 20;
struct node{
int id;
pii st, ed;
}a[N];
bool check(pii t, node area){
if(t.x < area.st.x || t.x > area.ed.x) return false;
if(t.y < area.st.y || t.y > area.ed.y) return false;
return true;
}
int main(){
int n, m; cin >> n >> m;
for(int i = 1; i <= n; i ++ ){
cin >> a[i].st.x >> a[i].st.y >> a[i].ed.x >> a[i].ed.y;
a[i].id = i;
}
for(int i = 1; i <= m; i ++ ){
int xx, yy; cin >> xx >> yy;
bool flag = false;
for(int j = n; j > 0; j -- ){
if(check({xx, yy}, a[j])){
flag = true;
cout << a[j].id << endl;
// 后面移
node key = a[j];
for(int k = j; k < n; k ++ ) a[k] = a[k + 1];
a[n] = key;
break;
}
}
if(!flag) cout << "IGNORED" << endl;
}
return 0;
}