首页 > 代码库 > luogu_1003 铺地毯

luogu_1003 铺地毯

#include<iostream>
#include<algorithm>
using namespace std;
int main(){
  int n,a1[10010],b1[10010],a2[10010],b2[10010],i,x,y;
  cin>>n;
  for(i=1;i<=n;i++)cin>>a1[i]>>b1[i]>>a2[i]>>b2[i];
  cin>>x>>y;
  for(i=n;i>=1;i--){
    if(x>=a1[i]&&x<=a2[i]+a1[i]&&y>=b1[i]&&y<=b2[i]+b1[i]){
      cout<<i<<endl;
      return 0;
    }
  }
  cout<<-1<<endl;
  return 0;
}

luogu_1003 铺地毯