2024-10-02 06:29:36 +00:00
|
|
|
#include <iostream>
|
|
|
|
#include <ranges>
|
|
|
|
|
|
|
|
using std::cin,std::cout;
|
|
|
|
|
|
|
|
constexpr const auto range = std::ranges::views::iota;
|
|
|
|
|
|
|
|
struct Point{
|
|
|
|
int x,y;
|
|
|
|
};
|
|
|
|
|
|
|
|
const int MAX_N = 1e4+5;
|
|
|
|
int n;
|
|
|
|
Point dir;
|
|
|
|
Point arr[MAX_N][2];
|
|
|
|
|
|
|
|
int main(){
|
|
|
|
std::iostream::sync_with_stdio(false),cin.tie(nullptr),cout.tie(nullptr);
|
|
|
|
|
|
|
|
cin>>n;
|
|
|
|
for(const int i:range(0,n)){
|
|
|
|
for(const int j:range(0,2)){
|
|
|
|
cin>>arr[i][j].x>>arr[i][j].y;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
cin>>dir.x>>dir.y;
|
|
|
|
|
2024-10-02 09:13:26 +00:00
|
|
|
for(int i=n-1;i>=0;i--){
|
|
|
|
if(arr[i][0].x<=dir.x && dir.x <= arr[i][0].x+arr[i][1].x
|
|
|
|
&& arr[i][0].y<=dir.y && dir.y <= arr[i][0].y+arr[i][1].y){
|
|
|
|
std::cout<<i+1<<"\n";
|
|
|
|
return 0;
|
2024-10-02 06:29:36 +00:00
|
|
|
}
|
|
|
|
}
|
2024-10-02 09:13:47 +00:00
|
|
|
std::cout<<-1<<"\n";
|
2024-10-02 06:29:36 +00:00
|
|
|
}
|