https://www.luogu.org/problem/P1003
#include <iostream>
#include <vector>
using namespace std;
struct SRectangle
{
int a;
int b;
int x;
int y;
};
int main()
{
int n;
vector<SRectangle> inputList;
int x,y;
cin >> n;
for(int i = 0; i < n; i++)
{
SRectangle r;
cin >> r.a >> r.b >> r.x >> r.y;
inputList.push_back(r);
}
cin >> x >> y;
vector<SRectangle>::reverse_iterator iter = inputList.rbegin();
while(iter != inputList.rend())
{
SRectangle& r = *iter;
if (x>=r.a && x <= r.a+r.x && y>= r.b && y<=r.b+r.y)
{
cout << n << endl;
return 0;
}
n--;
iter++;
}
cout << -1 << endl;
return 0;
}