90分求助!!!
查看原帖
90分求助!!!
798899
nike1325楼主2023/8/8 20:00

有一个点wa了

#include<bits/stdc++.h>
using namespace std;
constexpr int N = 1e4 + 10;
struct Node {
	int x1, x2, y1, y2;
}a[N];
int main() {
	int n;
	cin >> n;
	for (int i = 1; i <= n; i++) {
		cin >> a[i].x1 >> a[i].y1 >> a[i].x2 >> a[i].y2;
	}
	int x, y;
	cin >> x >> y;
	for (int i = n; i >= 1; i--) {
		if (x >= a[i].x1 && x <= a[i].x2&& y >= a[i].y1 && y <= a[i].y2) {
			cout << i;
			return 0;
		}
	}
	cout << -1;
	return 0;
}

2023/8/8 20:00
加载中...