这个样例也过不了怎么办?
查看原帖
这个样例也过不了怎么办?
1124986
simple1first楼主2023/12/19 21:17
#include<bits/stdc++.h>
using namespace std;
const int n = 2e5+3;

struct dt{
	int x1,y1,x2,y2;
}dt[n];

int main(){
	int n,a,b,g,k,x,y,ans;
	cin >> n;
	for(int i=0;i<n;i++){
		cin >> a >> b >> g >> k;
		dt[i] = {a ,b ,a+g-1 ,b+k-1};
	}
	cin >> x >>y;
	for(int i=n;i>=1;i--){
		if(dt[i].x1<=x && x<=dt[i].x2 && dt[i].y1<=y && y<=dt[i].y2){
			ans = i;
			break;
		}
	}
	if(ans!=0) cout << ans;
	else cout << "-1";
	
	return 0;
}
2023/12/19 21:17
加载中...