思路

一片一片放好 ,然后一片一片检查即可
时间复杂度 : O(n) + O(n)
空间复杂度 : S(n)

ac代码

#include<bits/stdc++.h>
using namespace std;
const int N =1e4+10;
int a[N] , b[N] , x[N] , y[N];
int main()
{
    int n ; cin >> n;
    for( int i = 1; i<=n;i++)
    {
        cin >> a[i]>>b[i]>>x[i]>>y[i];
    }
    int xx , yy ;
    cin >> xx >> yy;
    int id = -1;
    for(int i = 1 ;i<=n;i++)
    {
        if ( a[i]<=xx && xx <= a[i] + x[i] && 
             b[i]<=yy && yy<= b[i] + y[i] )
            id = i;
    }
    cout << id;
    return 0;
}