传送门 思路:一开始想的直接暴力,发现根本行不通,会runtime error,看了题解之后发现可以直接判断范围。
题意:可以开一个二维数组倒序来看,逆序扫一边发现点正好在所在范围,直接输出即可。
/**
* From:
* Qingdao Agricultural University
* Created by XiangwangAcmer
* Date : 2019-09-29-19.40.30
* Talk is cheap.Show me your code.
*/
using namespace std;
const ll maxn = 1e4 + 5;
const ll minn = 1e9 + 5;
const ll mod = 1000000007;
const int inf = 0x3f3f3f3f;
vector<int>v[maxn];
const long long LIMIT = 4294967295LL;
bool row[maxn], col[maxn];
bool flag = 0;
int a[maxn][4];
queue<int>q;
int main() {
ios::sync_with_stdio(false);
int cnt = 1, n;
cin >> n;
int x,y;
for(int i = 1; i <= n; i++)
cin >> a[i][0] >> a[i][1] >> a[i][2] >> a[i][3];
cin>>x>>y;
int flag=0;
for(int i=n;i>=1;i--)
{
if(a[i][0]<=x&&(a[i][0]+a[i][2])>=x&&a[i][1]<=y&&(a[i][1]+a[i][3])>=y)
{
flag=i;
break;
}
}
if(flag)
cout<<flag<<endl;
else cout<<-1<<endl;
return 0;
}