AcWing 3198. 窗口(小模拟)
原题链接
简单
作者:
蜜桃小丸子呀
,
2024-09-05 16:46:28
,
所有人可见
,
阅读 3
#include <iostream>
#include <vector>
using namespace std;
const int N = 15;
int n, m, a[N][5];
void puts_id(int& x, int& y) {
for (int i = n; i > 0; i--) {
if (x >= a[i][0] && y >= a[i][1] && x <= a[i][2] && y <= a[i][3]) {
cout << a[i][4] << endl;
int tmp[5] = { 0 };
for (int j = 0; j < 5; j++) tmp[j] = a[i][j];
for (int j = i; j < n; j++)
for (int k = 0; k < 5; k++)
a[j][k] = a[j + 1][k];
for (int j = 0; j < 5; j++) a[n][j] = tmp[j];
return;
}
}
cout << "IGNORED" << endl;
return;
}
int main() {
/*FILE* p = nullptr;
freopen_s(&p, "in.txt", "r", stdin);*/
cin >> n >> m;
for (int i = 1; i <= n; i++) {
cin >> a[i][0] >> a[i][1] >> a[i][2] >> a[i][3];
a[i][4] = i;
}
while (m--) {
int x, y;
cin >> x >> y;
puts_id(x, y);
}
return 0;
}