1 solutions
-
0
模拟题
储存地毯以后从下往上枚举地毯,每次覆盖点了就更新答案
#include<bits/stdc++.h> using namespace std; struct Rect{ int x,y,w,h; }; const int N=10010; Rect q[N]; int main() { int n; cin>>n; for(int i=1;i<=n;i++) { int x,y,w,h; cin>>x>>y>>w>>h; q[i]={x,y,w,h}; } int a,b; cin>>a>>b; int res=-1; for(int i=1;i<=n;i++) { int x=q[i].x,y=q[i].y,w=q[i].w,h=q[i].h; if(a>=x&&a<=x+w&&b>=y&&b<=y+h) { res=i; } } cout<<res; return 0; }
- 1
Information
- ID
- 1088
- Time
- 1000ms
- Memory
- 256MiB
- Difficulty
- 10
- Tags
- # Submissions
- 1
- Accepted
- 1
- Uploaded By