5253 铺地毯
#include<bits/stdc++.h> #define f(i,s,e) for(int i = s; i <= e; i++) #define ll long long using namespace std; const int N = 1e4+10,inf = 0x3f3f3f3f; int g[N][N]; int n,a[N],b[N],c[N],d[N]; int main() { cin >> n; f(i,1,n) scanf("%d%d%d%d",&a[i],&b[i],&c[i],&d[i]); int x,y; cin >> x >> y; for(int i = n; i >= 1; i--) //倒着来,因为最后盖上去的地毯是在最上面的 { //判断x,y是否在第i张地毯中 if((a[i] <= x && x <= a[i] + c[i]) && (b[i] <= y && y <= b[i] + d[i])) { cout << i; return 0; } } cout << -1; return 0; }

浙公网安备 33010602011771号