[NOIP2011 提高组] 铺地毯
2024年12月25日小于 1 分钟
#include <bits/stdc++.h>
using namespace std;
int n;
int x[10000 + 5], y[10000 + 5];
int xx[10000 + 5], yy[10000 + 5];
int main()
{
ios::sync_with_stdio(false);
cin.tie(0);
cin >> n;
for (int i = 1; i <= n; i++)
{
int a, b, g, k;
cin >> a >> b >> g >> k;
x[i] = a, y[i] = b;
xx[i] = a + g, yy[i] = b + k;
}
int X, Y;
cin >> X >> Y;
int ans = -1;
for (int i = 1; i <= n; i++)
if (x[i] <= X && X <= xx[i] &&
y[i] <= Y && Y <= yy[i])
ans = i;
cout << ans;
return 0;
}