代码:
#include<iostream>
#include<cstdio>
#include<algorithm>
#include<cstdlib>
#include<cstring>
using namespace std;
long long flag[4005][4005];
int n;
int a,b,g,k;
int sx,sy;
int maxx,maxy;
int main()
{
ios::sync_with_stdio(false);
memset(flag,-1,sizeof(flag));
cin>>n;
for (int i=1;i<=n;i++)
{
cin>>a>>b>>g>>k;
maxx=max(maxx,a+g);
maxy=max(maxy,b+k);
//cout<<maxx<<" "<<maxy<<endl;
for (int h=b;h<=b+k;h++)
{
for (int l=a;l<=a+g;l++)
{
flag[l][h]=i;
}
}
}
cin>>sx>>sy;
// for (int i=1;i<=maxy;i++)
// {
// for (int j=1;j<=maxx;j++)
// cout<<flag[j][i];
// cout<<endl;
// }
cout<<flag[sx][sy];
return 0;
}
求大佬帮助!