In the Indian Ocean, there are several small islands. A war ship is stationed in the ocean and wants to find how many of these islands are within its striking power
For simplicity, the islands are assumed to have square shapes and again, the curvature of the earth can be ignored. The coordinates of two opposite corners on
the islands are given and the position of the ship is also given. You need to find the islands in the increasing sequence of their distances from the ship. The
distance is the shortest distance - the distance of the nearest point on the island boundary from the ship. Use Manhattan Distance, Le distance betwee
(x1 y1) and (x2.72) is X1-x2] + ly1-y2].
t s
- Constraints
1 <= N<= 100000
-1049 <= x1i, yli, x2i,y2i <= 10^9.
- Input Format
First line contains single integer N denoting the number of islands
Next N lines contain 4 integers separated by space denoting the coordinates of the opposite corners of the islands (x1i, y1n) & (x21.y21). (1<=i<= N)
Islands are numbered 1,2,N.
The final line contains 2 integer separated by space denoting the coordinates of the warship
Output
Nintegers separated by space each integer denoting the index of island sorted by distance from warship in non-decreasing order
if 2 islands are at the same distance from warship, rank them according to their index.
Test Case
- Explanation
Answers
Answered by
1
Answer:
send the code
Explanation:
no ideas in this problems/program
Similar questions
Computer Science,
6 months ago
English,
6 months ago
Sociology,
11 months ago
English,
11 months ago
English,
1 year ago