Incense Sticks and Fragrance
Practice
5 (1 votes)
Mathematics
Easy
Mathematics
Mathamatics
Problem
46% Success 1495 Attempts 20 Points 1s Time Limit 256MB Memory 1024 KB Max Code

There are two incense sticks in a house.The fragrance is produced only when the individual aroma from each of these sticks react, the location of both the sticks is given.
There are N locations in the house and coordinates of each location is given. When a stick is burnt, its aroma spreads in the circular-form (this happens for both sticks). Each second it increases its radius by one meter.
You need to calculate the number of locations to which the fragrance can reach at the time t. Aroma from the incense sticks starts at t = 0.

Input :

The first line contains two integers \(x1\) and \(y1\) denoting coordinates of the first incense stick.
The second line contains two integers \(x2\) and \(y2\) denoting coordinates of the second incense stick.
Next line contains N, denoting the number of locations in the house.
Next line contains N-space separated integers denoting x coordinate of the \(i^{th}\) location.
Next line contains N-space separated integers denoting y coordinate of the \(i^{th}\) location.
Next line contains Q, denoting the number of queries.
Next line contains Q space-separated integers, each integer being a value of t for which you have to answer the number of locations affected.

Output
Output will contain Q space separated integers denoting number of affected locations at each of the query input.

Constraints
\(1 \le N \le 1000 \)
\(0 \le x1,y1,x2,y2 \le 1000\)
\(0 \le x \; and \; y \; coordinates \; of \; locations \le 1000\)
\(1 \le Q,t \le 1000\)

Please login to use the editor

You need to be logged in to access the code editor

Loading...

Please wait while we load the editor

Loading...
Results
Custom Input
Run your code to see the output
Submissions
Please login to view your submissions
Similar Problems
1.Bee
Points:20
1 votes
Points:20
4 votes
Tags:
Easy
Points:20
79 votes
Tags:
Ad-HocBasic ProgrammingOpenApprovedEasy